Python 无法将pip从1.5.4升级到最新版本
我正在运行UbuntuGnome14.04,并且已经为Python2.7.6和Python3.4.3安装了PIP1.5.4 我想将pip升级到最新版本,但在运行命令时 pip安装-U pip我得到以下错误Python 无法将pip从1.5.4升级到最新版本,python,ubuntu,pip,Python,Ubuntu,Pip,我正在运行UbuntuGnome14.04,并且已经为Python2.7.6和Python3.4.3安装了PIP1.5.4 我想将pip升级到最新版本,但在运行命令时 pip安装-U pip我得到以下错误 Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py
Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.5.4
Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Can't roll back pip; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
os.makedirs(destsubdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip'
Storing debug log for failure in /tmp/tmpDLrBk_
关于使用sudo,即
sudo-pip安装-U-pip
错误-
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
alzio@alzio-HP-Pavilion-Notebook:/$ sudo -H pip install --upgrade pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip in /usr/lib/python2.7/dist-packages
Downloading/unpacking pip
Cleaning up...
No distributions at all found for pip in /usr/lib/python2.7/dist-packages
Storing debug log for failure in /root/.pip/pip.log
我也有同样的问题。我使用备份了我的pip安装
sudo mv /usr/lib/python2.7/dist-packages/pip* .
sudo mv /usr/local/lib/python2.7/dist-packages/pip local_pip
然后我下载了一个引导脚本并执行了它:
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
您可以通过执行以下命令来确认pip已成功升级
pip -V
我从中获得了引导链接。我非常感谢您的反馈,因为我确信这可以简化,但重置我的pip版本可能会很棘手。在用python编程时应该使用。它将依赖项分开,您不应该有任何权限错误。如果您通过Ubuntu软件包(
python-pip
)安装了pip
,您不应该尝试通过pip
升级它;你应该等待Ubuntu升级它,或者找到一个更新的兼容apt的源代码。如果你想要比Ubuntu使用的更新的东西,你应该安装。@Craicerjack virtualenv不是必需的。如果要在系统范围内使用软件包,您应该正常安装。您可以随时以任何方式卸载pip
并使用这些说明重新安装-@实际上我真正想做的是将我的Django从1.6升级到1.9,但运行pip安装-U Django
时,我遇到错误:-无法获取索引基URLhttps://pypi.python.org/simple/ 在/usr/lib/python2.7/dist包中找不到任何满足Django要求的下载
I在谷歌上搜索发现这与pip版本有关