PIP升级权限被拒绝Windows 10

时间:2018-06-11 03:55:32

标签: python django python-3.x pip

Python 3.6.5和(当前)pip 9.0.3尝试升级到10.0.1。

我已经检查了各种SO线程,没有什么能让我在那里。当尝试pip安装任何东西并升级pip本身时,我不断得到这个:

这是我试图安装Django然后告诉我需要升级pip的时候。

例外:

Traceback (most recent call last):

File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)

File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,

File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs

File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)

File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,

File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)

File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)

File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)

File "c:\program files\python36\lib\os.py", line 220, in makedirs
    mkdir(name, mode)

PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python36\\Lib\\site-packages\\pytz'

这是在我尝试使用python -m pip install --upgrade pip升级点数之后:

例外:

Traceback (most recent call last):

File "C:\Program Files\Python36\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied:** 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst' -> 'C:\\Users\\johns\\AppData\\Local\\Temp\\pip-f8ej9z71-uninstall\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'

During handling of the above exception, **another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,

File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)

File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)

File "C:\Program Files\Python36\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)

File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)

File "C:\Program Files\Python36\lib\shutil.py", line 559, in move
    os.unlink(src)

PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'

我的上一台计算机上没有这个问题,所以我有点困惑。我不明白为什么我会有权限错误,我是管理员。我试过sudo(但我觉得那只是mac?)。我查看了有关如何操作和pip文档的repo讨论。而且我很确定我在安装时将Python添加到Path。

感谢您帮助我解决这个问题。

1 个答案:

答案 0 :(得分:1)

单击"以管理员身份运行"尝试打开命令提示符或Powershell。 您可以在此video找到相应的步骤。