任何想法如何更新Windows框上的python PIP?

boa*_*der 55 python windows pip virtualenv

pip install --upgrade pip 因为Windows FS被脑损坏而无法删除打开的文件,因此无效.

我已经尝试将我的环境设置为我想要更新的virtualenv,然后从另一个pip运行,但是失败了:

(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
Run Code Online (Sandbox Code Playgroud)

我希望别人找到解决方法.在linux上没问题....

Jon*_*nan 111

easy_install -U pip

:-)

  • 这太简单了.我不知道easy_install确实理解了virtualenvs.谢谢. (2认同)

Chr*_*ong 63

使用python作为主要可执行文件,将pip作为脚本运行.

python -m pip install -U pip
Run Code Online (Sandbox Code Playgroud)

  • 时代已经改变,我认为这是实现这一目标的新方法. (5认同)
  • 是的,这似乎是PIP开发人员在讨论这个错误时决定推荐的内容:https://github.com/pypa/pip/issues/1299 (3认同)

Mar*_*ski 18

[更新2015-11-15]此帖已过时且已过时.目前的最佳实践是根据pip使用以下内容:

python -m pip install -U pip setuptools
Run Code Online (Sandbox Code Playgroud)

这是没有必要使用easy_installsetuptools的.从pip-installer页面更新pip的建议过程是使用get-pip.py.

要安装或升级 pip,请安全下载get-pip.py.

您可以在像msysgit的Git Bash这样的Bash shell中使用以下内容.

user@machine ~$ curl -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
Run Code Online (Sandbox Code Playgroud)

使用该-L选项可以遵循重定向.最近GitHub更改了原始内容的URL,因此旧的原始get-pip.pyURL已被重定向,并在pip网站上更改了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...
Run Code Online (Sandbox Code Playgroud)

您可以为Windows命令行修改此项,但首先如果您没有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你应该找到curl.exe.好极了!现在在一个Windows shell中,在提示符后输入它(将使用您的用户名代替myusername),替换path\to\Curl\为下载curl.exe文件的路径.

C:\Users\myusername> path\to\Curl\curl.exe -kL https://bootstrap.pypa.io/get-pip.py | python
Run Code Online (Sandbox Code Playgroud)

您需要-k允许curl访问没有证书的安全GitHub pip站点的选项.另外,感谢Piotr Dobrogost告诉我有关Windows管道的信息|,这可以节省保存文件的步骤.

如果您已经拥有最新版本的pip,您将收到以下消息:

$ 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...
Run Code Online (Sandbox Code Playgroud)

也适用于virtualenvs.