Python 记一次更新 pip 失败
作者:互联网
背景
看到 warning 有点不舒服,便更新了一下 pip:
(base) C:\Users\Administrator>pip install --upgrade pip
Requirement already satisfied: pip in d:\anaconda3\lib\site-packages (21.0)
Collecting pip
Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 242 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.0
Uninstalling pip-21.0:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\\anaconda3\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
因为权限问题导致未能成功更新 pip,而导致此时 pip 已经有所残缺,无法正常使用了。
(base) C:\Users\Administrator>pip install --upgrade pip
Script file 'D:\Anaconda3\Scripts\pip-script.py' is not present.
解决 'pip-script.py' is not present.
:重新安装 pip
Windows
下载并运行安装脚本:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
- linux 需要使用 sudo 执行安装脚本:
sudo python get-pip.py
- pip 会被安装到当前解释器环境中。
(base) C:\Users\Administrator>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1882k 100 1882k 0 0 174k 0 0:00:10 0:00:10 --:--:-- 104k
(base) C:\Users\Administrator>python get-pip.py
Collecting pip
Using cached pip-21.0.1-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.3.3
Uninstalling pip-20.3.3:
Successfully uninstalled pip-20.3.3
Successfully installed pip-21.0.1
Debian 和 Ubuntu 等
部分 Linux 发行版可直接用包管理器安装 pip,如 Debian 和 Ubuntu:
sudo apt-get install python-pip
标签:21.0,get,Python,py,更新,python,--,pip 来源: https://www.cnblogs.com/ercilan/p/14434814.html