我使用命令pip3 install ipython 但得到这些错误 我可能需要安装virtualenv吗?
Exception:
Traceback (most recent call last):
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/saurabh/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/IPython'
答案 0 :(得分:1)
错误消息显示问题:由于PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/IPython'
是系统文件夹,因此您无权写入文件夹。
sudo
您需要使用--user
全局安装或仅使用pip install ipython --user
选项安装它们,该选项仅为当前用户安装软件包,而不是全部安装:
tidy
或许更好的选择是使用virtual environment为您隔离包。
答案 1 :(得分:0)
如果在安装任何软件包期间出现任何权限问题/错误,请始终在安装命令之前添加sudo
。因此命令将是:
sudo pip3 install IPython