如何在虚拟环境中升级点子?

时间:2018-12-13 17:06:40

标签: python pip virtualenv

尽管没有答案可以解决此问题,但已经在这里提出了这个问题。

pip upgrade fails inside virtual environment

上述问题是重复的,并附有以下参考答案:

gaierror: [Errno -2] Name or service not known

但是此答案不包含任何有效内容。前一个答案也没有任何有用的信息!

我的问题正是第一个链接中描述的。 我尝试将点数从10.0.1升级到18.1,但无法升级。结果,我无法安装Tensorflow。这个虚拟环境实际上已经连接到pycharm,我通过命令行引用它。这是输入和相应的命令行输出:

(venv) G:\Ashish\Tensorflow\venv\Scripts>pip install --upgrade pip
ERROR: To modify pip, please run the following command:
G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.


(venv) G:\Ashish\Tensorflow\venv\Scripts>G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
Requirement already up-to-date: pip in g:\ashish\tensorflow\venv\lib\site-packages (18.1)

(venv) G:\Ashish\Tensorflow\venv\Scripts>pip --version
pip 10.0.1 from g:\ashish\tensorflow\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)

(venv) G:\Ashish\Tensorflow\venv\Scripts>pip install --upgrade pip
ERROR: To modify pip, please run the following command:
G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.


(venv) G:\Ashish\Tensorflow\venv\Scripts>

我尝试从虚拟环境卸载点子。我没工作。很抱歉,这是基础知识还是涉及虚拟环境的基础知识,这是我的学习阶段,也是我开始为这个令人敬畏的社区做出贡献之前的一段时间。

1 个答案:

答案 0 :(得分:1)

好吧,感谢@hoefling和@Rahul Bhardwaj的建议

对于显示10.0.1和18.1的python环境:

pip in your virtual environment is 18.1 while the global pip is 10.0.1. So the issue is solved, simply upgrade global pip

对于未安装的tensorflow:

Install python 3.6
Add that to path 
Create a virtual environment in pycharm using python 3.6 
Install tensorflow

完成! Python 3.7尚未支持tensorflow