ubuntu 更换pip源

python爱好者

# 查找pip的全局设置文件位置
pip config list -v

# 1. 命令行永久修改法
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

# 2. 配置文件修改法
# 创建一个名为.pip的文件夹
mkdir ~/.pip  
# 进入创建的文件夹
cd ~/.pip
# 创建pip.conf
touch pip.conf
# 编辑文件
sudo vim ~/.pip/pip.conf
 
# 复制下面的内容到文件中(配置的豆瓣源,也可以配置别的)
[global]                                                                    
index-url = http://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn

1.命令行直接更改

#临时更改

pip install markdown -i https://pypi.tuna.tsinghua.edu.cn/simple

#全局更改

# 清华源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

# 阿里源

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

# 腾讯源

pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple

# 豆瓣源

pip config set global.index-url http://pypi.douban.com/simple/

2.通过文件设置

#创建pip文件夹

sudo mkdir /root/.pip

cd /root/.pip

#创建pip.cong文件

touch pip.conf

#编辑pip.conf文件

sudo vim pip.conf

#在pip.conf文件中添加镜像源地址即可

[global]

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

镜像源地址:

  1. 阿里云 https://mirrors.aliyun.com/pypi/simple/
  2. 豆瓣https://pypi.douban.com/simple/
  3. 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  4. 中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/
  5. 华中科技大学https://pypi.hustunique.com/

相关推荐

  1. ubuntu 更换pip

    2023-12-22 00:12:02       72 阅读
  2. Ubuntu pip

    2023-12-22 00:12:02       64 阅读
  3. 添加pip,ubuntu

    2023-12-22 00:12:02       29 阅读
  4. pip安装加速】pip 更换清华

    2023-12-22 00:12:02       52 阅读
  5. ubuntu 更换国内镜像

    2023-12-22 00:12:02       40 阅读
  6. ubuntu 搭建本地私有pip

    2023-12-22 00:12:02       70 阅读
  7. Ubuntu系统更换清华大学镜像

    2023-12-22 00:12:02       60 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-22 00:12:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-22 00:12:02       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-22 00:12:02       82 阅读
  4. Python语言-面向对象

    2023-12-22 00:12:02       91 阅读

热门阅读

  1. JUC、MySQL

    2023-12-22 00:12:02       37 阅读
  2. log4js-node在nodejs项目中的使用示例

    2023-12-22 00:12:02       54 阅读
  3. node设置镜像源

    2023-12-22 00:12:02       61 阅读
  4. centos磁盘扩容

    2023-12-22 00:12:02       62 阅读
  5. Codeforces Round 916 (Div. 3)(A~F)

    2023-12-22 00:12:02       65 阅读
  6. Git 中 rebase、reset、revert 有什么区别?

    2023-12-22 00:12:02       55 阅读
  7. hive(2)

    2023-12-22 00:12:02       43 阅读