终端在 PyCharm 中有不同的 Python 版本

我当前的 Python 版本是 3.8,但我也在另一个目录中安装了 python 3.6。我的 IDE 是 PyCharm。我使用 3.6 版建立了一个新项目,因此我可以使用旧版本的 Tensorflow,即 Tensorflow==2.0.0b1。但是,在此项目上使用 pip install 时,它仍然可以识别版本 3.8。我的问题是如何将 pip 安装到我的 3.6 目录而不是 3.8 站点包文件夹。

这里是错误:

C:\Users\my_folder_name\PycharmProjects\Anomaly_Dectection>pip install tensorflow==2.0.0
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tensorflow==2.0.0
ERROR: No matching distribution found for tensorflow==2.0.0
WARNING: You are using pip version 21.0.1; however,version 21.2.1 is available.
You should consider upgrading via the 'c:\program files\python38\python.exe -m pip install --upgrade pip' command.

我需要 pip 安装到这里:

C:\Users\folder_name\AppData\Local\Programs\Python\Python36\Lib\site-packages

P.S:我为这个新项目使用 Python 3.6 设置了一个 venv。

xiaohou0604 回答:终端在 PyCharm 中有不同的 Python 版本

当您从脚本文件夹运行 pip 时,它应该可以工作:

C:\Users\folder_name\AppData\Local\Programs\Python\Python36\Scripts

如果您的当前目录中没有 pip3,Windows 正在查看您的 PATH 变量,我猜,它从最新的 python 中获取 pip3,而不是 3.6。

本文链接:https://www.f2er.com/9020.html

大家都在问