PermissionError:pip从8.1.1升级到8.1.2

时间:2016-09-23 11:02:35

标签: python django pip pycharm python-3.5

我正在尝试将pip从8.1.1升级到8.1.2。 但它显示以下'PermissionError: [WinError 5] Access is denied: 如何升级pip?

C:\>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\shutil.py", line 538, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst' -> 'C:\\Users\\user\\AppD
ata\\Local\\Temp\\pip-nen4ldwg-uninstall\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 726, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", line 746, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\Program Files\Python35\lib\shutil.py", line 553, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

即使使用管理员权限也会出现此问题。

2 个答案:

答案 0 :(得分:0)

使用管理员权限打开您的cmd。右键单击图标,然后选择以管理员身份打开。

答案 1 :(得分:0)

在您需要.content:before { content: ""; position: fixed; left: 0; right: 0; z-index: 0; display: block; background-image: url("/img/dark-abstract-hd-wallpapers.jpg"); background-size: cover; data-role: fitImage; width: 100%; height: 100%; -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); filter: blur(5px); } .content { position: fixed; left: 0; right: 0; z-index: 0; margin-left: 20px; margin-right: 20px; } #main { width: 100%; position: relative; margin: 0 auto; line-height: 1.4em; } @media only screen and (max-width: 479px) { #main { width: 90%; } } 的默认python环境中升级PIP,即在Windows术语中,您必须以管理员模式启动命令提示符。事实上,不建议这样做。

如果您设置了virtualenv,则无需使用sudo /'Windows管理员。设置Python virtualenv 是python最佳做法,因此您可以分离单个项目所需的pip包。对于Windows,它是similar setup

尽管如此,如果你的PC有足够的RAM,只需安装Virtualbox并部署ubuntu即可。这样,您不需要处理开发人员忽视的Windows python包安装/升级(尽管所有python包都假设开箱即用)。