首页 > 编程语言 >python 安装的国内镜像源

python 安装的国内镜像源

时间:2023-08-27 23:24:00浏览次数:45  
标签:cn python pypi tsinghua edu pip 镜像 安装

Python 镜像源是指可以用来下载 Python 相关软件包的在线仓库地址。Python 在国内使用的比较广泛,为了提高安装包的下载速度,一般会配置国内镜像源。常见的 Python 镜像源包括以下几个:

默认情况下 pip 使用的是国外的镜像,在下载的时候速度非常慢,本文我们介绍使用国内清华大学的源,地址为:

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

我们可以直接在 pip 命令中使用 -i 参数来指定镜像地址,例如:

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

以上命令使用清华镜像源安装 numpy 包。

这种只对当前安装对命令有用,如果需要全局修改,则需要修改配置文件。

Linux/Mac os 环境中,配置文件位置在 ~/.pip/pip.conf(如果不存在创建该目录和文件):

mkdir ~/.pip

打开配置文件 ~/.pip/pip.conf,修改如下:

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

查看 镜像地址:

$ pip3 config list   
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='https://pypi.tuna.tsinghua.edu.cn'

可以看到已经成功修改了镜像。

Windows下,你需要在当前对用户目录下(C:\Users\xx\pip,xx 表示当前使用对用户,比如张三)创建一个 pip.ini在pip.ini文件中输入以下内容:

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

其他国内镜像源

标签:cn,python,pypi,tsinghua,edu,pip,镜像,安装
From: https://www.cnblogs.com/GeophysicsWorker/p/17661074.html

相关文章

  • Obsidian插件Excalidraw安装slideshow脚本
    原文地址:https://www.cnblogs.com/liqinglucky/p/slideshow.html插件介绍:Excalidraw的动态演示效果来了,伟大的匈牙利大叔又放狠招了,你的Obsidian更好用了_哔哩哔哩_bilibili由于一开始我的电脑访问github很慢,在安装slideshow时总是提示couldnotopenscriptenginerepository......
  • 重新做人 再学一遍python
    print()input()格式化输出: 字符串:判断子串是否在父串中:  取子串:  字符串操作:  ......
  • Dockerfile完全指南_构建镜像
    简单示例在一个空白的文本文件,命名为DockerfilevimDockerfile示例1Dockerfile文件内容:#基础镜像FROMcentos#维护者MAINTAINERbaizhan<[email protected]>#运行命令RUN"yuminstallwget"#启动容器运行命令CMDecho"helloDockerfile"示例2Dockerf......
  • VSCode中配置Python运行环境
    1首先需要下载相应的包可以在官网中分别下载python和anaconda的安装包,按照步骤进行下载安装即可。python安装成功的标志为cmd中输入python可以进入python的运行环境。anaconda安装成功的标志为打开anacondaprompt可以输入“condalist”来查看目前已经集成的库。2在VSCode中下载......
  • python中求DNA的反向互补序列
     001、  利用循环结构实现[root@PC1test01]#lsa.fatest.py[root@PC1test01]#cata.fa##测试DNA序列AAAACCCGGT[root@PC1test01]#cattest.py##程序#!/usr/bin/envpython#-*-coding:utf-8-*-in_file=open("a.fa","r")file=......
  • python 中实现字符串反转的几种方法
     001、利用切片实现>>>str1="abcdef"##测试字符串>>>str1[::-1]'fedcba' 002、利用for循环实现>>>str1="abcdef"##测试字符串>>>rev="">>>foriinstr1:......
  • python中实现RNA序列的翻译
     001、利用循环结构实现[root@PC1test01]#lsa.fatest.py[root@PC1test01]#cata.fa##测试RNA序列AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA[root@PC1test01]#cattest.py##翻译程序#!/usr/bin/envpython#-*-coding:utf......
  • 解决wsl正确安装torch_sparse、torch_scatter的问题
    快速解决torch_sparse、torch_scatter安装并正确使用的问题我们如果直接进行pipinstall后,会因为pip的机制自动下载最新版本的其他依赖,例如torch等cuda版本。所以我们需要找到对应自己电脑的cuda版本的模块whl,进行离线安装。找到对应版本打开https://pytorch-geometric.com/wh......
  • python操作Excel
    安装依赖用户目录下配置依赖下载源:pip.ini[global]index-url=https://pypi.tuna.tsinghua.edu.cn/simple[install]trusted-host=pypi.tuna.tsinghua.edu.cn安装依赖:pipinstallopenpyxl,pandas......
  • 10在centos7安装RabbitMQ Server
    一.erlang环境安装erlang语言环境和RabbitMQ版本的对应关系如下:https://www.rabbitmq.com/which-erlang.html  本次安装RabbitMQ 3.11.20 和erlang25.3.2.5进入erlang官网下载https://www.erlang.org/patches/otp-25.3.2.5 安装编译环境yuminstallmakeg......