linux 中 给pip配置源

 

001、

[root@PC1 ~]# pip config list

 

002、

[root@PC1 ~]# cd ~
[root@PC1 ~]# ls -a
.                .bash_history  .bashrc  .cshrc   Documents  .ICEauthority         Music     Public           .tcshrc    .viminfo
..               .bash_logout   .cache   .dbus    Downloads  initial-setup-ks.cfg  Pictures  .python_history  Templates
anaconda-ks.cfg  .bash_profile  .config  Desktop  .esd_auth  .local                .pki      .ssh             Videos
[root@PC1 ~]# mkdir .pip
[root@PC1 ~]# ls -a
.                .bash_history  .bashrc  .cshrc   Documents  .ICEauthority         Music     .pki             .ssh       Videos
..               .bash_logout   .cache   .dbus    Downloads  initial-setup-ks.cfg  Pictures  Public           .tcshrc    .viminfo
anaconda-ks.cfg  .bash_profile  .config  Desktop  .esd_auth  .local                .pip      .python_history  Templates
[root@PC1 ~]# cd .pip/
[root@PC1 .pip]# ls

 

003、

备用源:

  • 豆瓣 https://pypi.douban.com/simple/
  • 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  • 中科大 https://pypi.mirrors.ustc.edu.cn/simple/
  • 阿里云 https://mirrors.aliyun.com/pypi/simple/

 

[root@PC1 .pip]# vim pip.conf    ## 增加如下内容,保存退出
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/      ## 可以更换
[install]
trusted-host = https://pypi.mirrors.ustc.edu.cn/

 

004、

[root@PC1 .pip]# pip config list
global.index-url='https://pypi.mirrors.ustc.edu.cn/simple/'
install.trusted-host='https://pypi.mirrors.ustc.edu.cn/'

 

005、安装测试

[root@PC1 .pip]# pip install pandas

 

005、列出第三方库

[root@PC1 .pip]# pip list

 

006、临时指定源

[root@PC1 .pip]# pip install flask -i https://mirrors.aliyun.com/pypi/simple

 

参考:

001、https://zhuanlan.zhihu.com/p/349015182?utm_id=0

002、https://blog.csdn.net/weixin_42873928/article/details/105437729

003、https://blog.csdn.net/weixin_43632687/article/details/104646607

 

posted @ 2023-05-16 01:07  小鲨鱼2018  阅读(783)  评论(0编辑  收藏  举报