问题
I am unable to import sqlalchemy. I searched and found few solutions like installing flask or flask_sqlalchemy etc. None of these helped.
What am I missing?
回答1:
Sometimes, you need to restart ipython
for it to find freshly-installed modules.
I believe this holds for modules that add to sys.path
.
As per Can I zip all the python standard libs and the python still able to import it? , site.main()
should work, too.
It, among other things, scans site-packages
directories for .pth
files and adds their contents to sys.path
. Thanks to the fact that its logic checks for duplicates before adding, it shouldn't clutter sys.path
when invoked repeatedly.
来源:https://stackoverflow.com/questions/43494172/no-module-named-sqlalchemy-after-having-just-installed-it-from-ipython-prompt