Skip to content
SRE运维进阶之路SRE运维进阶之路
github icon
    • 1 Python 简介

      • 1.1 初识Python
        • 1.2 Python 代码规范
          • 1.3 Python 虚拟环境
            • 1.4 使用 vscode 打造 python 开发环境
              • 1.5 pypi 配置国内镜像
              • 2 Python 基础

                • 2.1 Python基础语法
                  • 2.2 程序控制
                    • 2.3 Python数据类型

                      • 2.3.1 数值型
                        • 2.3.2 字符串 str
                          • 2.3.3 字节序列
                            • 2.3.4 列表 list & 元组 tuple
                              • 2.3.5 集合 set & 字典 dict
                            • 3 高级特性

                              • 3.1 线性结构特征 可迭代 & 切片
                                • 3.2 列表、集合、字典解析式
                                  • 3.3 生成器
                                    • 3.4 迭代器
                                    • 4 函数

                                      • 4.1 函数的定义 & 调用 & 返回值
                                        • 4.2 函数参数
                                          • 4.3 作用域
                                            • 4.4 递归函数
                                            • 5 函数式编程

                                              • 5.1 高阶函数
                                                • 5.2 返回函数
                                                  • 5.3 匿名函数
                                                    • 5.4 装饰器
                                                      • 5.5 偏函数
                                                      • 6 模块

                                                        • 6.1 Python 模块常用的几种安装方式
                                                          • 6.2 Python 的 setup.py 详解
                                                          • 7 IO编程

                                                            • 7.1 操作文件和目录
                                                              • 7.2 序列化和反序列化
                                                              • 8 异常、调试和测试

                                                                • 8.1 异常处理
                                                                • 9 面向对象编程

                                                                  • 9.1 类、实例和封装
                                                                    • 9.2 访问控制和属性装饰器
                                                                      • 9.3 继承、多态和Mixin
                                                                      • 10 进程和线程

                                                                        • 10.1 多进程
                                                                          • 10.2 多线程
                                                                            • 10.2 线程同步
                                                                            • 11 网络编程

                                                                              • 11.1 SocketServer
                                                                                • 11.2 TCP 编程
                                                                                • 11 魔术方法
                                                                                  • 17 IO 模型
                                                                                    • python 实际工作中的实例
                                                                                    • 前端学习笔记

                                                                                      1.5 pypi 配置国内镜像

                                                                                      author iconClaycalendar icon2021年6月8日category icon
                                                                                      • Python
                                                                                      timer icon小于 1 分钟

                                                                                      # 1.5 pypi 配置国内镜像

                                                                                      转载自:Python | willseecloud | 看云

                                                                                      pypi 国内镜像目前有:

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

                                                                                      手动指定源,可以在pip后面跟-i 来指定源,比如用豆瓣的源来安装web.py框架:

                                                                                      pip install -i http://pypi.douban.com/simple/ gevent
                                                                                      
                                                                                      pip3 install pip --upgrade -i https://mirrors.aliyun.com/pypi/simple/
                                                                                      
                                                                                      pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
                                                                                      
                                                                                      easy_install -i http://pypi.douban.com/simple/ gevent
                                                                                      
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      5
                                                                                      6
                                                                                      7

                                                                                      配置文件指定源,linux下修改~/.pip/pip.conf,如果没这文件则创建。

                                                                                      mkdir ~/.pip
                                                                                      cat > ~/.pip/pip.conf << EOF 
                                                                                      [global]
                                                                                      trusted-host=mirrors.aliyun.com
                                                                                      index-url=https://mirrors.aliyun.com/pypi/simple/
                                                                                      EOF
                                                                                      
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      5
                                                                                      6

                                                                                      easy_install配置国内源

                                                                                      cat > ~/.pydistutils.cfg << EOF 
                                                                                      [easy_install]
                                                                                      index-url=https://mirrors.aliyun.com/pypi/simple/ 
                                                                                      find-links=https://mirrors.aliyun.com/pypi/simple/
                                                                                      EOF
                                                                                      
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      5

                                                                                      windows配置

                                                                                      文件夹窗口输入 :

                                                                                      %APPDATA%
                                                                                      
                                                                                      1

                                                                                      新建一个pip文件夹,在pip文件夹里面新建一个配置文件pip.ini:

                                                                                      [global]
                                                                                      trusted-host=mirrors.aliyun.com
                                                                                      index-url=https://mirrors.aliyun.com/pypi/simple/
                                                                                      
                                                                                      1
                                                                                      2
                                                                                      3

                                                                                      清华源

                                                                                      [global]
                                                                                      timeout = 6000
                                                                                      index-url = https://pypi.tuna.tsinghua.edu.cn/simple
                                                                                      trusted-host = pypi.tuna.tsinghua.edu.cn
                                                                                      
                                                                                      1
                                                                                      2
                                                                                      3
                                                                                      4
                                                                                      edit icon编辑此页open in new window
                                                                                      上次编辑于: 2021/6/22 03:51:27
                                                                                      贡献者: clay-wangzhi
                                                                                      上一页
                                                                                      1.4 使用 vscode 打造 python 开发环境
                                                                                      备案号:冀ICP备2021007336号
                                                                                      Copyright © 2023 Clay