‘sqlacodegen‘ 不是内部或外部命令,也不是可运行的程序或批处理文件的解决方法

    技术2022-07-11  134

    问题:

    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()

     

    Processed: 0.021, SQL: 9