繁体   English   中英

在终端中找不到用于 python 执行的 pip3 安装库

[英]pip3 installed library can't be found for python execution in terminal

I installed tensorflow by using pip3, tensorflow also appears in the pip3 list, but when I try to import tensorflow by executing tensorflow in terminal, it says it cannot find the module tensorflow. 当我启动 jupyter 笔记本时,tensorflow 导入工作正常。 可能是什么原因? 我检查了终端和 jupyter 中的 sys.executable 值。 在终端中,它是'/usr/local/bin/python3',在jupyter中它是'/usr/local/opt/python/bin/python3.7'。

Enyang,jupyter 很有可能将默认设置自动设置为此路径。 我在 2 个 python 环境中遇到了很多问题。 以下是故障排除试验:

试验一:

尝试使用pippip3并使用参数-t, --target <dir>

试验二:

它的情况是 jupyter notebook 调整了你的python pip3尝试更改 pip 默认位置。

试验 3 [肯定会起作用]:

手动复制粘贴到 python 安装路径/s 中的合并库。

  • 试验 4 [明显]:

尝试venv (虚拟环境)并从pip freeze的工作版本导入您的要求

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM