现在发现pip安装不了东西了,错误也是下面那个在终端输入pip install virtualenv安装virtualenv报错,错误如下
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 308, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 646, in install
**kwargs
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 816, in install
strip_file_prefix=strip_file_prefix
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1013, in move_wheel_files
strip_file_prefix=strip_file_prefix,
File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib64/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/virtualenv.py'
黄舟2017-04-17 17:37:16
with open(dst, 'wb') as fdst
As in the above sentence, pip
在安装库时需要写入一些文件,因此需要写入权限
,如果按照楼上的方法,pip
命令前加上sudo
依然不行,可以考虑把/usr/lib/python2.7/
change the directory permissions to 666 or 777:
chmod 777 /usr/lib/python2.7