flask-sqlacodegen is not recognized as an external or internal command

Viewed 518

I'm try to run flask-sqlacodegen on my command line, but i keep getting this error:

flask-sqlacodegen is not recognized as an external or internal command

Here is what i did:

py -3.8 -m pip install flask-sqlacodegen

Which installed the library without any problem. But then, when i try to run a command from my command line, i'll get the error. Here is what i tried:

 py -3.8 flask-sqlacodegen  mysql://username:password@host:port/db_name --schema yourschema --tables table1,table2 --flask

py -3.8 -m flask-sqlacodegen  mysql://username:password@host:port/db_name --schema yourschema --tables table1,table2 --flask

flask-sqlacodegen  mysql://username:password@host:port/db_name --schema yourschema --tables table1,table2 --flask

All of them gave me the same error. I tried the same with sqlacodegen and still got the same error. Can anyone help me out on this?

1 Answers

It could be that it installed it to a different directory than where your PYTHONPATH points to, i.e. the package itself is not present in .../lib/python3.x/site-packages where your PYTHONPATH points to.

You can check that like so on your cmd line for windows( apply relevant cmd for your OS)

pip freeze | findstr "sqlacodegen"

This would return empty.

Check-in your cmd/shell

py --version

If this is not the same as Python3.8 then set that to the PYTHONPATH of this to your environment variables. This will solve the problem.

You can also, simply install it with without pip by

git clone https://github.com/ksindi/flask-sqlacodegen.git
cd flask-sqlacodegen/
python setup.py install
Related