Python - PIP 安装疑难解答 - PermissionError: [WinError 5] Access is denied [英] Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied

查看:37
本文介绍了Python - PIP 安装疑难解答 - PermissionError: [WinError 5] Access is denied的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 PIP 安装新软件包甚至将 pip 本身升级到最新版本时,我收到以下错误.我正在使用 Python 3.4 的 Windows 8.1 机器上运行 pip.

I get the following error when using PIP to either install new packages or even upgrade pip itself to the latest version. I am running pip on a windows 8.1 machine with Python 3.4.

该消息告诉我我没有文件的管理权限(我的帐户是管理员帐户).

The message is telling me I don't have Administrative Permission on the files (my account is an Administrator Account).

对于如何解决此问题的任何想法,我将不胜感激,因为它妨碍了安装软件包和使用 Python 的进展.

I would appreciate any thoughts on how to resolve this, as it is getting in the way of installing packages and progressing with Python.

错误信息:

Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Removing file or directory c:program files (x86)pythonpython34libsite-packagespip-6.0.8.dist-infodescription.rst
      Cleaning up...
Exception:
Traceback (most recent call last):
  File "C:Program Files (x86)PythonPython34libshutil.py", line 523, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\program files (x86)\python\python34\lib\site-packages\pip-6.0.8.dist-info\description.rst' -> 'C:\Users\User\AppData\Local\Temp\pip-uze_sc4k-uninstall\program files (x86)\python\python34\lib\site-packages\pip-6.0.8.dist-info\description.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:Program Files (x86)PythonPython34libsite-packagespipasecommand.py", line 232, in main
    status = self.run(options, args)
  File "C:Program Files (x86)PythonPython34libsite-packagespipcommandsinstall.py", line 347, in run
    root=options.root_path,
  File "C:Program Files (x86)PythonPython34libsite-packagespip
eq
eq_set.py", line 543, in install
    requirement.uninstall(auto_confirm=True)
  File "C:Program Files (x86)PythonPython34libsite-packagespip
eq
eq_install.py", line 667, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:Program Files (x86)PythonPython34libsite-packagespip
eq
eq_uninstall.py", line 126, in remove
    renames(path, new_path)
  File "C:Program Files (x86)PythonPython34libsite-packagespiputils\__init__.py", line 316, in renames
    shutil.move(old, new)
  File "C:Program Files (x86)PythonPython34libshutil.py", line 536, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'c:\program files (x86)\python\python34\lib\site-packages\pip-6.0.8.dist-info\description.rst'

推荐答案

E:由于这个答案似乎获得了一些人气,我要补充一点:在大多数情况下,在全球范围内做事并不是一个好主意.几乎总是正确的答案是:使用不全局安装东西的项目环境,例如使用 virtualenv.

E: Since this answer seems to have gained some popularity, I will add: doing things globally is most of the time not a great idea. Almost always the correct answer is: use a project environment where you're not installing things globally, e.g. with virtualenv.

对于那些可能遇到相同问题的人:

For those that may run into the same issue:

以管理员身份运行命令提示符.在帐户中拥有管理员权限并不总是足够的.在 Windows 中,可以通过右键单击可执行文件并选择以管理员身份运行"来以管理员身份运行.所以,在开始菜单中输入cmd",右键单击cmd.exe,以管理员身份运行.

Run the command prompt as administrator. Having administrator permissions in the account is not always enough. In Windows, things can be run as administrator by right-clicking the executable and selecting "Run as Administrator". So, type "cmd" to the Start menu, right click cmd.exe, and run it as administrator.

这篇关于Python - PIP 安装疑难解答 - PermissionError: [WinError 5] Access is denied的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆