Windows环境安装步骤
1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本
2. python get-pip.py # 运行安装脚本
3. 配置环境变量 C:\python-3.6.3\Scripts
4. 执行 pip --version
如果显示:pip 21.1.3 from c:\python-3.6.3\Lib\site-packages\pip (python 3.6) 表示安装成功
pip安装异常问题和解决办法:
安装pip后若报错:ModuleNotFoundError: No module named 'pip'
则需要在Python目录下,找到pythonXX._pth文件
并在文件中加入Lib\site-packages即可,文件内容如下:
pythonXX.zip
.
Lib\site-packages
# Uncomment to run site.main() automatically#import site
具体报错堆栈如下:
pip
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\python-3.6.3\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'