更改Python的pip install 默认使用的pip库及默
2020-05-10 本文已影响0人
xianling_he
- Win系统下面安装了2个版本的python
- 因为之前python3.7已经安装了很多有关tar包,已经有项目在使用
- 需要切换更高的版本python3.8使用,这样又需要重新下载tar包到scripts文件夹下面
其实如果遇到多版本python需要切换的话,建议使用virtualEnv的方法,我在之前的帖子已经写过。
更改python默认的pip install默认使用pip库
- 打开终端并查看当前pip包存放路径
pip show pip
![](https://img.haomeiwen.com/i20044978/77ef270b9b250f85.png)
-
主要是Script文件夹需要在Path中靠前位置
image.png
![](https://img.haomeiwen.com/i20044978/b5a02343a1ea8fdd.png)
更改Python的pip install默认安装路径
- 查看site.py文件路径
python -m site -help
![](https://img.haomeiwen.com/i20044978/ea8fb85197d9d82c.png)
- 打开site.py并修改USER_BASE 和 USER_SITE
USER_BASE: 用户自定义安装依赖包路径
USER_SITE: 用户自定义启用Python脚本路径
![](https://img.haomeiwen.com/i20044978/e902ffcc5d7e70dc.png)
安装库文件并进行验证
pip install wheel
![](https://img.haomeiwen.com/i20044978/4c0a7a2a3ea5ba0a.png)
![](https://img.haomeiwen.com/i20044978/e92b1971118700db.png)
python -m site
![](https://img.haomeiwen.com/i20044978/30a58606e2bbbf30.png)