python -m无法找到已安装的模块(ipython)

发布于 2025-01-29 23:11:38 字数 727 浏览 2 评论 0原文

我有一些我不明白的行为:

python告诉我我使用/opt/app-root/bin/python
当我尝试调用python -m ipython找不到模块。当我刚运行ipython时,它只是有效的。我真的不明白为什么会发生这种情况,因为由于/opt/app -root/bin/python是路径python -m xxx使用,所以我认为<代码> ipython 和python -m ipython实际上是相同的命令。我在这里错了吗?

(app-root) bash-4.4# which python
/opt/app-root/bin/python
(app-root) bash-4.4# python -m ipython
/opt/app-root/bin/python: No module named ipython
(app-root) bash-4.4# ipython
Python 3.9.7 (default, Sep 13 2021, 08:18:39)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.3.0 -- An enhanced Interactive Python. Type '?' for help.

I have some behaviour I do not understand:

which python tells me I use /opt/app-root/bin/python.
When I try to call python -m ipython the module is not found. When I just run ipython it just works. I don´t really understand why this is happening, because since /opt/app-root/bin/python is the path python -m xxx uses, I would think ipython and python -m ipython are actually the same commands. Am I wrong here?

(app-root) bash-4.4# which python
/opt/app-root/bin/python
(app-root) bash-4.4# python -m ipython
/opt/app-root/bin/python: No module named ipython
(app-root) bash-4.4# ipython
Python 3.9.7 (default, Sep 13 2021, 08:18:39)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.3.0 -- An enhanced Interactive Python. Type '?' for help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文