Python3:尝试在Ubuntu 16.04中升级pip3,但未更新 [英] Python3: Trying to upgrade pip3 in Ubuntu 16.04 but it doesn't update
问题描述
基本上是标题.我想升级pip,因为我已经无法使用python获取新软件包了.
Basically, the title. I want to upgrade pip because I cannot get new packages in python because it is obsolete.
当我尝试从Ubuntu终端运行pip3 install --upgrade pip
时,会发生这种情况:
When I try to run pip3 install --upgrade pip
from the Ubuntu terminal, this happens:
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并重新安装,但无济于事.
How should I solve this problem? I tried to purge pip and reinstall it,but to no avail.
另外,也尝试了pip的升级命令,但似乎不起作用.
Also, tried the upgrade command with pip too, but it didn't seem to work.
推荐答案
-
尝试:
Try:
sudo pip3 install --upgrade pip
- 如果收到找不到命令",则应执行以下操作:
权限被拒绝"错误通常可以通过在命令中添加"sudo"来解决.
"Permission denied" errors are usually solved by adding "sudo" to your commands.
(sudo只是执行具有特权的给定命令的关键字)
(sudo is just a keyword to execute a given command with privileges)
在命令控制台中输入Python,它将告诉您所使用的Python版本.
Type Python into your command console, it will tell you which version of Python you are using.
C:/>python Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
如果您具有 Python 3.x ,则应使用 pip3 ;如果您具有 Python 2.x ,则应使用 pip .
If you have Python 3.x you should use pip3, if you have Python 2.x you should use pip.
如果您使用的是正确的pip,但仍然收到找不到命令",则必须安装pip:
If you are using the right pip but still get the "command not found" then you have to install pip:
对于 Python2.x :
sudo apt-get install python-pip
对于 Python 3.x :
sudo apt-get install python3-pip
这篇关于Python3:尝试在Ubuntu 16.04中升级pip3,但未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!