基本上,标题已经说明了。我想升级 pip,因为它已经过时,无法在 Python 中获取新的包。
当我尝试从 Ubuntu 终端运行
当我尝试从 Ubuntu 终端运行
pip3 install --upgrade pip
时,会出现以下情况: Collecting pip
Using cached pip-9.0.3-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "/home/marcell/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/marcell/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/marcell/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/marcell/.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/marcell/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/marcell/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/marcell/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/marcell/.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/pip'
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我该如何解决这个问题?我尝试清除pip并重新安装它,但没有效果。
补充说明:我也尝试使用pip的升级命令,但似乎没有起作用。
sudo pip3 install --upgrade pip
的形式运行它。 - the.salman.a