Python pip替换为阿里源的方法步骤

yipeiwu_com6年前Python基础

背景

由于 python 自带的源下载速度非常慢,特别是安装一些库的时候,甚至有时会失败。

pip国内的一些镜像

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

替换

首先在 windows 当前用户家的目录下,创建一个 pip 文件夹,然后创建一个pip.ini文件,修改文件内容为如下;

[global] 
index-url = http://mirrors.aliyun.com/pypi/simple/ 
[install] 
trusted-host=mirrors.aliyun.com 

备注

  1. 记得一定是pip.ini,如果没有开后缀的同学,记得把文件后缀打开,再修改文件的后缀为ini即可。
  2. 用户家目录为
C:\Users\****  # **** 就是当前登录用户名, 比如登录用户名是Luke, 那么就是C:\Users\Luke  

下面是视图:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python高级特性与几种函数的讲解

切片 从list或tuple中取部分元素。 list = [1, 2, 3, 4] list[0 : 3] # [1, 2, 3] list[-2 : -1] # -1表示最后一个,...

python定时器(Timer)用法简单实例

本文实例讲述了python定时器(Timer)用法。分享给大家供大家参考。具体如下: # encoding: UTF-8 import threading #Timer(定时器)是T...

python 提取key 为中文的json 串方法

示例: # -*- coding:utf-8 -*- import json strtest = {"中故宫":"好地方","天涯":"北京"} print strtest ###...

Python计算开方、立方、圆周率,精确到小数点后任意位的方法

Python计算开方、立方、圆周率,精确到小数点后任意位的方法

Python计算的位数 在电脑上做了一个实验,看看python能计算到多少位,一下是结果。 x = math.sqrt((3)) print ("%.53f"%(x)) print...

pyqt5 实现 下拉菜单 + 打开文件的示例代码

如下所示: # -*- coding: utf-8 -*- import sys import os from PyQt5 import QtCore, QtGui, QtWidge...