您的位置:首页 > 娱乐 > 八卦 > Linux更换pip下载镜像源

Linux更换pip下载镜像源

2024/12/21 20:01:01 来源:https://blog.csdn.net/Lzcsfg/article/details/140700498  浏览:    关键词:Linux更换pip下载镜像源

Windows中修改pip下载源-CSDN博客

本机Linux发行版本: Rocky_linux9.4

方法一: 

[root@localhost ~]# mkdir /root/.pip
[root@localhost ~]# vim /root/./.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/[install]
trusted-host=mirrors.aliyun.com

下载测试:

[root@localhost ~]# pip3 install NumPy
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting NumPyDownloading http://mirrors.aliyun.com/pypi/packages/b1/e3/24d289c5a3255bf52824bd52295e9a7923cad8ae5ec29539fc971e1122f6/numpy-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.5/19.5 MB 1.8 MB/s eta 0:00:00
Installing collected packages: NumPy
Successfully installed NumPy-2.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

方法二: 

# 使用本镜像站来升级 pip
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple pip -U
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple

下载测试: 

[root@localhost pip]# pip3 install requests
Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple
Collecting requestsDownloading https://mirrors.bfsu.edu.cn/pypi/web/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl (64 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 3.0 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2 (from requests)Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/98/69/5d8751b4b670d623aa7a47bef061d69c279e9f922f6705147983aa76c3ce/charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 142.3/142.3 kB 998.1 kB/s eta 0:00:00
Collecting idna<4,>=2.5 (from requests)Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/e5/3e/741d8c82801c347547f8a2a06aa57dbb1992be9e948df2ea0eda2c8b79e8/idna-3.7-py3-none-any.whl (66 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.8/66.8 kB 509.3 kB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1 (from requests)Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/ca/1c/89ffc63a9605b583d5df2be791a27bc1a42b7c32bab68d3c8f2f73a98cd4/urllib3-2.2.2-py3-none-any.whl (121 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 880.4 kB/s eta 0:00:00
Collecting certifi>=2017.4.17 (from requests)Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/1c/d5/c84e1a17bf61d4df64ca866a1c9a913874b4e9bdc131ec689a0ad013fb36/certifi-2024.7.4-py3-none-any.whl (162 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.0/163.0 kB 453.5 kB/s eta 0:00:00
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2024.7.4 charset-normalizer-3.3.2 idna-3.7 requests-2.32.3 urllib3-2.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com