我今天第一次使用了pip,我收到了有用的消息
您正在使用pip版本8.1.1,但版本9.0.1可用。 您应该考虑通过“pip install --upgrade pip”进行升级。命令。
所以,我继续前进
pip install --upgrade pip
但事情没有按计划进行......
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 510kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
File "//anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "//anaconda/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "//anaconda/lib/python2.7/site-packages/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "//anaconda/lib/python2.7/site-packages/pip/req/req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "//anaconda/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "//anaconda/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "//anaconda/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/anaconda/lib/python2.7/site-packages/pip-8.1.1.dist-info/DESCRIPTION.rst'
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
现在看来pip完全从我的电脑上消失了:
$ pip
-bash: //anaconda/bin/pip: No such file or directory
pip真的不见了,也就是说,它真的卸载了,然后无法重新安装,或者做了什么只是取消链接?我将来如何避免这个问题?因为我可以想象我需要在某个时候再次升级pip ......
答案 0 :(得分:2)
您可以使用pip
重新安装conda
:
conda install pip
看起来你需要拥有root权限:
sudo conda install pip
答案 1 :(得分:0)
尝试curl https://bootstrap.pypa.io/get-pip.py | python
它应该重新安装PIP
答案 2 :(得分:0)
Python 附带了一个用于安装 pip 的模块,无需从 Internet 中提取任何名为 ensurepip
的内容。使用起来非常简单,只需在终端中运行以下命令:
python -m ensurepip
从那里您可以将 pip 升级到最新的标准方式。此处提供了其他文档https://docs.python.org/3/library/ensurepip.html。