我不断收到消息以升级点子 [英] I keep getting a message to upgrade pip
问题描述
每当创建虚拟货币时,都会收到一条消息,要求我升级点子.我运行该命令进行升级,它再次在另一个venv上弹出.我怎样才能使它永久化.
Whenever I create a venv, I get a message asking me to upgrade pip. I run the command for upgrade, and it pops up again on another venv. How can I make this permanent.
消息:
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
更新: 刚收到建议阅读此可能重复的答案: virtualenv使用升级的系统默认pip
Update: Just received recommendation to read this possible duplicate answer: virtualenv use upgraded system default pip
这不能解决我的问题.为什么?
This does not solve my issue though. Why?
我的pip3
似乎已经是最新的:
My pip3
appears to already be up to date:
C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip --version
pip 18.0 from c:\users\mkupfer\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip (python 3.6)
C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip3 --version
pip 18.0 from c:\users\mkupfer\appdata\local\programs\python\python36-32\lib\sit
e-packages\pip (python 3.6)
C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip3 install --upgrade pip
Requirement already up-to-date: pip in c:\users\mkupfer\appdata\local\programs\p
ython\python36-32\lib\site-packages (18.0)
已解决
解决方案:通过使用virtualenv
来创建新的虚拟环境,我能够完全解决此问题.不知道这是否是venv
中的错误.我将只使用可以继续使用的软件包.感谢@James Lim的回答.
Solved
Solution: I was able to fix this altogether by using virtualenv
to create a new virtual environment. Not sure if this is a bug in venv
. I'll just use the package that works going forward. Thanks @James Lim for the answer.
推荐答案
问题似乎是 new 虚拟环境正在使用旧版本的pip.请注意,pip是从virtualenv随附的源tarfile(或wheel)安装的,位于site-packages/virtualenv_support
目录中.
The issue seems to be that new virtual environments are using an old version of pip. Note that pip is installed from a source tarfile (or wheel) included with virtualenv, in the site-packages/virtualenv_support
directory.
$ ls -l /path/to/site-packages/virtualenv_support
pip-9.1-py2.py3-none-any.whl
解决此问题的快速方法是确保每次创建新的virtualenv时都升级pip,如下所示:
A quick way to workaround the problem is to make sure you upgrade pip whenever you create a new virtualenv, like so:
$ virtualenv venv
$ venv/bin/pip install -U pip
或者,确保您具有最新版本的virtualenv.根据他们的发行说明,virtualenv==16
正在使用pip==10
.
Alternatively, make sure you have the latest version of virtualenv. According to their release notes, virtualenv==16
is using pip==10
.
$ pip install -U virtualenv
最后,由于virtualenv在virtualenv_support
中查找pip*.whl
,因此这也将起作用:
Finally, since virtualenv looks for pip*.whl
in virtualenv_support
, this will also work:
$ mv /path/to/site-packages/virtualenv_support/pip*.whl{,bak}
$ pip wheel -w /path/to/site-packages/virtualenv_support/ 'pip==18'
所有新的virtualenvs将使用您安装到virtualenv_support
中的pip版本.但是,这感觉很棘手.
All new virtualenvs will use the version of pip that you installed into virtualenv_support
. However, this feels hacky.
(尝试用virtualenv==16
.这将导致所有新的虚拟环境都带有pip == 18.)
(Attempted with virtualenv==16
. This results in all new virtualenvs with pip==18.)
这篇关于我不断收到消息以升级点子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!