首页 > 编程语言 >使用国内镜像通过pip安装python 包

使用国内镜像通过pip安装python 包

时间:2023-05-19 17:02:11浏览次数:35  
标签:v2ex http python pypi simple pip 镜像


pip安装python包时超时或是报错“Cannot fetch index base URL http://e.pypi.python.org/simple/”



解决方法:加上参数"-i http://pypi.v2ex.com/simple",即换成国内镜像。

一劳永逸的办法:~/.pip/ 下创建文件 pip.conf(如果还没有的话),并填入以下内容:


1  [ global ]
2  timeout =  6000
3  index - url =  http: / / pypi.v2ex.com / simple
4  [install]
5  use - mirrors =  true
6  mirrors =  http: / / e.pypi.python.org

标签:v2ex,http,python,pypi,simple,pip,镜像
From: https://blog.51cto.com/u_2700990/6314013

相关文章

  • nodejs npm国内镜像
    镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):1.通过config命令npmconfigsetregistryhttp://registry.cnpmjs.orgnpminfounderscore(如果上面配置正确这个命令会有字符串response)2.命令行指定npm--registryhttp://registry.cn......
  • Python 列表append自己
    list=['zz','ss']list.append(list)print(id(list[2]))print(id(list[2][0]))print("1:",list)list.append(list)print(id(list[3]))print(id(list[3][0]))print("2:",list)结果:1404637464558161404637464107361:['z......
  • python使用exchangelib读取、保存exchange邮件
    importosfromdatetimeimportdatetimeimportpytzfromexchangelibimportCredentials,Account,Configuration,DELEGATE,Q,FileAttachmentdefreceived_exchange_message():"""接收exchange邮件,保存邮件到本地:return:""......
  • centos 8 安装python3
    sudodnfinstallpython3  查看版本 查看pip ......
  • 01_Python 基础
    01_Python基础Python解释器&pycharm安装注释#变量常量input#输入框if#条件判断while#循环关键字continuebreak关键字pass01.for循环for变量in可迭代的东西:代码把可迭代的东西中的每一项内容拿出来,挨个的赋值给变量,每一次赋值都要执行......
  • python os.environ操作环境变量
    1、.env文件数据添加到环境变量load_dotenv(ROOT_DIR+'/.env',verbose=True)或load_dotenv(find_dotenv('.env')2、新增环境变量,其中key和value均为string类型os.environ['环境变量名称']='环境变量值'  环境变量立刻生效,从设置开始后面的运行部分都能获取到该变量os.e......
  • python面试题汇总
    以下是一些常见的Python面试题以及它们的答案:Python中的GIL是什么,有何作用?GIL全称GlobalInterpreterLock,是Python解释器在多线程情况下保证线程安全的一种机制。GIL确保同一时间只有一个线程可以执行Python字节码,从而避免了由于多个线程同时修改共享数据造成的竞态条件问题。解释......
  • 删除docker images中为none的镜像
    查看现有镜像➜safelinedockerimagesREPOSITORYTAGIMAGEIDCREATEDSIZEchaitin/safeline-tengine1.5.125a6146e6aed13hoursago119MBchaitin/safeline-tenginelatest25a6146e6aed13hoursago119M......
  • 使用Python脚本修改Linux用户的密码
    直接上代码使用python,通过系统默认的passwd命令,修改用户Tom的密码为NewPasswordimportsubprocess#Gettheusernameandnewpasswordfromtheuserusername="Tom"new_password="NewPassword"#Usethe'passwd'commandtoupdatethepassword#Th......
  • 【视频】风险价值VaR原理与Python蒙特卡罗Monte Carlo模拟计算投资组合实例|附代码数
    原文链接:http://tecdat.cn/?p=22862 最近我们被客户要求撰写关于风险价值VaR的研究报告,包括一些图形和统计输出。风险价值(VaR)是一种统计数据,用于量化公司、投资组合在特定时间范围内可能发生的财务损失程度 ( 点击文末“阅读原文”获取完整代码数据******** )。什么是风......