您的位置:首页 > 编程语言 > Python开发

在Windows系统下用pip安装时,PremissionError错误解决办法

2017-05-02 17:32 691 查看
当用pip install package_name 语句直接安装时,出现如下报错:

C:\Users\wangz>pip install pygame
Collecting pygame
  Using cached pygame-1.9.3-cp36-cp36m-win_amd64.whl
Installing collected packages: pygame
Exception:
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] 拒绝访问。: 'c:\\program files\\python36\\Lib\\site-packages\\pygame'

此时应该采用 pip install --user package_name 语法进行安装:

C:\Users\wangz>pip install --user pygame
Collecting pygame
  Using cached pygame-1.9.3-cp36-cp36m-win_amd64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.3
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python pip PremissionError
相关文章推荐