‘sqlacodegen‘ 不是內部或外部命令,也不是可運行的程序或批處理文件的解決方法

問題:

windows:

'sqlacodegen' 不是內部或外部命令,也不是可運行的程序或批處理文件

linux:

sqlacodegen: command not found 

The program 'sqlacodegen' is currently not installed. To run 'sqlacodegen' please ask your administrator to install the package 'sqlacodegen'

解決方法:

import sqlacodegen.main

if __name__ == '__main__':
    genstr = 'sqlacodegen --noviews --outfile po.py mysql+mysqlconnector://name:pw@localhost:3306/db --tables tab'
    temp = genstr.split(' ')[1:]
    genarr = []
    for a_temp in temp:
        if not a_temp == '':
            genarr.append(a_temp)
    sys.argv.extend(genarr)
    sqlacodegen.main.main()

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章