更新pip版本的过程
刚开始学Python,各种问题靠百度。尝试下更新pip。
pip show pip
pip install --upgrade pip
提示:
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is
You should consider upgrading via the 'd:\users\administrator\appdata\
rams\python\python37\python.exe -m pip install --upgrade pip' command.
直接到库下载
https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
- pip‑20.2.4‑py3‑none‑any.whl
pip install pip-20.2.4-py3-none-any.whl
提示:
D:\Users\Administrator\AppData\Local\Programs\Python\Python37\Scripts>pip instal
l pip-20.2.4-py3-none-any.whl
Processing d:\users\administrator\appdata\local\programs\python\python37\scripts
\pip-20.2.4-py3-none-any.whl
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.1.1
Uninstalling pip-20.1.1:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝
访问。: 'd:\\users\\administrator\\appdata\\local\\programs\\python\\python37\\s
cripts\\pip.exe'
Consider using the `--user` option or check the permissions.
还是不行啊
切换目录
cd D:\Users\Administrator\AppData\Local\Programs\Python\Python37\
各种问题
C:\Users\Administrator>python.exe -m pip install -U pip
D:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe: No mod
ule named pip
最后百度偶然从百度结果看到这条 python -m ensurepip
C:\Users\Administrator>python -m ensurepip
Looking in links: c:\Users\ADMINI~1\AppData\Local\Temp\tmp9mb74enp
Requirement already satisfied: setuptools in d:\users\administrator\appdata\loca
l\programs\python\python37\lib\site-packages (47.1.0)
Processing c:\users\admini~1\appdata\local\temp\tmp9mb74enp\pip-20.1.1-py2.py3-n
one-any.whl
Installing collected packages: pip
WARNING: The scripts pip3.7.exe and pip3.exe are installed in 'D:\Users\Admini
strator\AppData\Local\Programs\Python\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.
Successfully installed pip-20.1.1
解决了No module named pip
再继续解决更新问题
python.exe -m pip install --upgrade pip
最后看到希望:
再次经过折腾 需要在我的电脑 右键 属性 环境变量里加入pip的路径
C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xshell 6\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Users\Administrator\AppData\Local\Programs\Python\Python37\Scripts
复制里面的内容到记事本,新增加的路径前面用英文的分号连接。记得不要有换行符,否则路径可能添加失败。再次检查后添加。
最后成功。