本文介绍了“没有名为 sqlalchemy 的模块"刚刚从 IPython 提示符安装后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法导入 sqlalchemy.我搜索并找到了一些解决方案,例如安装flask或flask_sqlalchemy等.这些都没有帮助.

我错过了什么?

解决方案

有时,您需要重新启动 ipython 才能找到新安装的模块.

我相信这适用于添加到 sys.path 的模块.

根据 我可以压缩所有 python 标准库并且 python 仍然能够导入它吗?site.main() 应该也可以.>

除其他外,它会扫描 site-packages 目录中的 .pth 文件并将其内容添加到 sys.path.由于它的逻辑在添加之前检查重复项,因此在重复调用时它不应该使 sys.path 混乱.

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?

解决方案

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.

这篇关于“没有名为 sqlalchemy 的模块"刚刚从 IPython 提示符安装后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 15:25