我无法在ubuntu中使用命令行安装setuptools。我已经使用了" pip install setuptools"但它显示错误:
Exception:
Traceback (most recent call last):
File "/home/logan/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/logan/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/logan/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/logan/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/logan/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/logan/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/logan/.local/lib/python2.7/site-packages/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/appdirs.py'
帮帮我吧!
答案 0 :(得分:1)
您没有权限更改需要更改的文件。
Permission denied: '/usr/local/lib/python2.7/dist-packages/appdirs.py'
以root身份再次运行它,或者在它前面使用sudo运行它。要么是这样,要么尝试授予该文件夹的权限。
su root
pip install setuptools
或
sudo pip install setuptools
或
chmod -R +w /usr/local/lib/python2.7;
pip install setuptools
或在本地安装。您可以使用--user标志或virtualenv(如果已安装)执行此操作。
pip install --user setuptools
或
virtualenv <envdir>
source <envdir>/activate
pip install setuptools
答案 1 :(得分:0)
你是否以root身份运行?以root用户身份运行或使用--user标志放入您自己的区域。
答案 2 :(得分:0)
最后一行表示您没有足够的权限安装到/ usr / lib中。
也许您需要至少拥有超级用户权限才能这样做,但这取决于您的操作系统。
快速解决方案是尝试使用sudo