任何想法如何更新窗口框上的Python PIP?
pip install --upgrade pip
不起作用,因为Windows FS脑损坏,不会让你删除一个打开的文件。
我已经尝试将我的环境设置为我想更新的virtualenv,然后从不同的点运行,但失败:
(jm) E:\python\jm>c:\Python26\Scripts\pip install --upgrade pip Downloading/unpacking pip Running setup.py egg_info for package pip warning: no previously-included files matching '*.txt' found under directory 'docs\_build' no previously-included directories found matching 'docs\_build\_sources' Installing collected packages: pip Found existing installation: pip 0.7.1 Uninstalling pip: Successfully uninstalled pip Running setup.py install for pip warning: no previously-included files matching '*.txt' found under directory 'docs\_build' no previously-included directories found matching 'docs\_build\_sources' Installing pip-script.py script to c:\Python26\Scripts Installing pip.exe script to c:\Python26\Scripts Installing pip.exe.manifest script to c:\Python26\Scripts Installing pip-2.6-script.py script to c:\Python26\Scripts Installing pip-2.6.exe script to c:\Python26\Scripts Installing pip-2.6.exe.manifest script to c:\Python26\Scripts Exception: Traceback (most recent call last): File "c:\Python26\lib\site-packages\pip-0.7.1-py2.6.egg\pip\basecommand.py", line 120, in main File "c:\Python26\lib\site-packages\pip-0.7.1-py2.6.egg\pip\commands\install.py", line 165, in run File "c:\Python26\lib\site-packages\pip-0.7.1-py2.6.egg\pip\req.py", line 1251, in install File "c:\Python26\lib\site-packages\pip-0.7.1-py2.6.egg\pip\req.py", line 466, in commit_uninstall File "c:\Python26\lib\site-packages\pip-0.7.1-py2.6.egg\pip\req.py", line 1549, in commit File "c:\Python26\lib\shutil.py", line 216, in rmtree rmtree(fullname, ignore_errors, onerror) File "c:\Python26\lib\shutil.py", line 216, in rmtree rmtree(fullname, ignore_errors, onerror) File "c:\Python26\lib\shutil.py", line 221, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "c:\Python26\lib\shutil.py", line 219, in rmtree os.remove(fullname) WindowsError: [Error 5] Access is denied: 'c:\\users\\mark\\appdata\\local\\temp\\pip-gvsove-uninstall\\python26\\scripts\\pip.exe' Storing complete log in C:\Users\mark\AppData\Roaming\pip\pip.log (jm) E:\python\jm>dir c:\Users\mark\AppData\Local\temp\pip-gvsove-uninstall\python26\scripts Volume in drive C has no label. Volume Serial Number is 74E4-FE9F Directory of c:\Users\mark\AppData\Local\temp\pip-gvsove-uninstall\python26\scripts 12/07/2010 11:32 AM <DIR> . 12/07/2010 11:32 AM <DIR> .. 05/14/2010 05:54 PM 7,168 pip.exe 1 File(s) 7,168 bytes 2 Dir(s) 22,824,603,648 bytes free (jm) E:\python\jm>del c:\Users\mark\AppData\Local\temp\pip-gvsove-uninstall\python26\scripts\pip.exe
我希望别人有办法解决这个问题。 它在Linux上没有问题….
easy_install -U pip
🙂
运行pip作为脚本,使用python作为主要的可执行文件。
python -m pip install -U pip
[更新2015-11-15]这篇文章已经过时,并且已经过时。 目前最好的做法是根据点是使用以下内容:
python -m pip install -U pip setuptools
没有必要使用setuptools的 easy_install
。 从pip-installer页面更新pip的build议步骤是使用get-pip.py
。
要安装或升级 pip,请安全地下载
get-pip.py
。
你可以在Bash shell中使用如下的msysgit的Git Bash 。
user@machine ~$ curl -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
使用-L
选项来跟随redirect。 最近GitHub更改了原始内容的URL,所以旧的原始get-pip.py
url已被redirect,并在点子网站上更改了url 。 如果成功,您应该看到以下内容:
$ curl -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1309k 100 1309k 0 0 364k 0 0:00:03 0:00:03 --:--:-- 366k Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.6-py2.py3-none-any.whl#md5=4d4fb4b69df6731c7aeaadd6300bc1f2 Installing collected packages: pip Found existing installation: pip 1.5.4 Uninstalling pip: Successfully uninstalled pip Successfully installed pip Cleaning up...
你可以修改这个命令行,但首先如果你没有libcurl, 从Curl下载一个Windows二进制文件 。 你会想一直滚动到底部,并获得GünterKnauf目前的官方Win32二进制文件(目前7.29),并解压缩。 不要担心它是32位与64位。 只要确保你得到所有的钟声和口哨(ssl,zlib等)。 现在导航到您下载curl的文件夹,可能是c:\Users\<you>\Downloads
,打开解压缩的文件夹,可能是curl-7.29.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32
,你应该findcurl.exe
。 好极了! 现在在一个Windows shell中,在提示符后面(这将提供你的用户名而不是myusername
),用下载的curl.exe
文件的pathreplacepath\to\Curl\
。
C:\Users\myusername> path\to\Curl\curl.exe -kL https://bootstrap.pypa.io/get-pip.py | python
您需要使用-k
选项来允许curl在没有证书的情况下访问安全的GitHub pip站点。 另外,感谢Piotr Dobrogost告诉我有关Windowspipe道的信息 ,这节省了保存文件的步骤。
如果您已经拥有最新版本的点子,您将收到以下消息:
$ curl https://bootstrap.pypa.io/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1309k 100 1309k 0 0 369k 0 0:00:03 0:00:03 --:--:-- 371k Requirement already up-to-date: pip in c:\python27\lib\site-packages Cleaning up...
在virtualenvs中也可以正常工作。