前言:
转载必须标明出处!!!
这几天把python版本升级后,发现pip安装模块好多都报错(暂不确定是不是因为升级导致的),我定睛一看,发现是权限的问题,那么怎么解决呢?
1 权限问题
C:Usersljf>pip install xlwt
Exception: Traceback (most recent call last): File "c:program filespython35libsite-packagespipasecommand.py", line 21 1, in main status = self.run(options, args) File "c:program filespython35libsite-packagespipcommandsinstall.py", li ne 311, in run root=options.root_path, File "c:program filespython35libsite-packagespip eq eq_set.py", line 64 6, in install **kwargs File "c:program filespython35libsite-packagespip eq eq_install.py", lin e 803, in install self.move_wheel_files(self.source_dir, root=root) File "c:program filespython35libsite-packagespip eq eq_install.py", lin e 998, in move_wheel_files isolated=self.isolated, File "c:program filespython35libsite-packagespipwheel.py", line 339, in move_wheel_files clobber(source, lib_dir, True) File "c:program filespython35libsite-packagespipwheel.py", line 310, in clobber ensure_dir(destdir) File "c:program filespython35libsite-packagespiputils\__init__.py", line 71, in ensure_dir os.makedirs(path) File "c:program filespython35libos.py", line 241, in makedirs mkdir(name, mode) PermissionError: [WinError 5] 拒绝访问。: 'c:\program files\python35\Lib\sit e-packages\xlwt'
注意看我标红的那部分,提示说权限错误,拒绝访问,我们这样解决:
1 首先切换到c:\program files\目录下,
2 我们鼠标右击python35这个目录,点击 属性 ,
3 首先切换到 安全 这个大标题下面,选中当前登陆的用户,然后再点击编辑,编辑完以后不要忘记点击应用,
4 点击添加的权限,我这里为了方便全部一块选了,反正根据自己的实际情况而定,最后点击应用,再点击确定就大功告成。
5 我们此时再看看自己pip,是不是能够安装模块了。