首页 > 代码库 > pip安装提示PermissionError: [WinError 5]错误问题解决
pip安装提示PermissionError: [WinError 5]错误问题解决
问题现象
新安装python3.6版本后使用pip安装第三方模块失败,报错信息如下:
C:\Users\linyfeng>pip install lxml Collecting lxml Downloading http://pypi.doubanio.com/packages/fb/41/b8d5c869d01fcb77c72d7d226a847a3946034ef19c244ac12920b71cd036/lxml-3.8.0-cp36-cp36m-win32.whl (2.9MB) 100% |████████████████████████████████| 2.9MB 4.6MB/s Installing collected packages: lxml Exception: Traceback (most recent call last): File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run prefix=options.prefix_path, File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install **kwargs File "c:\program files (x86)\python36-32\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 (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files isolated=self.isolated, File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber ensure_dir(destdir) File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir os.makedirs(path) File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs mkdir(name, mode) PermissionError: [WinError 5] 拒绝访问。: ‘c:\\program files (x86)\\python36-32\\Lib\\site-packages\\lxml‘
问题分析
提示错误很明显报错的是PermissionError,应该是权限不足。查找了下资料,确认使用登录账号为普通用户,需要使用administrator权限运行cmd。提供一种简单易操作的方法以administrator权限执行cmd,如下
(1) 查找cmd运行绝对路径
C:\Users\shiyanan>where cmd
C:\Windows\System32\cmd.exe
(2) 到C:\Windows\System32目录下,右键单击cmd.exe文件以管理员身份运行。如下
可以发现路径名变成了C:\Windows\system32>
(3) 重新执行pip install lxml,结果如下
C:\Windows\system32>pip install lxml Collecting lxml Downloading http://pypi.doubanio.com/packages/fb/41/b8d5c869d01fcb77c72d7d226a847a3946034ef19c244ac12920b71cd036/lxml-3.8.0-cp36-cp36m-win32.whl (2.9MB) 100% |████████████████████████████████| 2.9MB 6.8MB/s Installing collected packages: lxml Successfully installed lxml-3.8.0
(4) 结束
pip安装提示PermissionError: [WinError 5]错误问题解决
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。