主页 M

python环境变量配置,更换pip源及安装问题

2018-09-16 网页编程网 网页编程网

法一:在cmd下输入: path=%path%;D:Python37

接着按"Enter"回车键。

其中: D:Python37  是Python的安装目录。

法二:在"高级系统设置"中选择"系统变量"窗口下面的"Path",双击即可!

然后在"Path"行,添加python安装路径即可(我的D:Python37)。 ps:路径用分号";"隔开!

最后在cmd命令行,输入命令"python",若显示相关信息则设置无误。

2.pip安装换源

pip时,指定临时源:pip install pythonModuleName -i https://pypi.douban.com/simple

3.换版本

安装lxml问题,由于版本问题造成,只能安装低版本如下:

pip install lxml==4.2.5

4.查看已安装

查看已安装pip包及其版本

pip3 freeze

5.查看pip包安装位置

pip show ryu(包名)

6.pip3换成自己的源

6.1国内可用的源

清华:https://pypi.tuna.tsinghua.edu.cn/simple

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

阿里云:https://mirrors.aliyun.com/pypi/simple

6.2修改配置文件

在当前用户目录下建立文件夹.pip,然后在文件夹中创建pip.conf文件,再将源地址加进去即:

mkdir ~/.pip
vim ~/.pip/pip.conf

然后将下面这两行复制进去:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

6.3指定源安装

pip3 install NumPy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install statsmodels -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
阅读原文
阅读 3790
123 显示电脑版