• 将pip源更换到国内镜像


    将pip源更换到国内镜像

    用pip管理工具安装库文件时,默认使用国外的源文件,因此在国内的下载速度会比较慢,可能只有50KB/s。幸好,国内的一些顶级科研机构已经给我们准备好了各种镜像,下载速度可达2MB/s。
    其中,比较常用的国内镜像包括:

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

    设置方法:(以清华镜像为例,其它镜像同理)
    (1)临时使用:
    可以在使用pip的时候,加上参数-i和镜像地址(如
    https://pypi.tuna.tsinghua.edu.cn/simple),
    例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas,这样就会从清华镜像安装pandas库。

    (2)永久修改,一劳永逸:
    (a)Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
    内容如下:

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

    (b) windows下,直接在user目录中创建一个pip目录,如:C:Usersxxpip,然后新建文件pip.ini,即 %HOMEPATH%pippip.ini,在pip.ini文件中输入以下内容(以豆瓣镜像为例):

    [global]
    index-url = http://pypi.douban.com/simple
    [install]
    trusted-host = pypi.douban.com
    创建pip.ini文件可以用文本编辑器,例如 sublime text3。

    杨河
  • 相关阅读:
    Autowired注解原理
    postgresql 网页访问
    halconregion_to_bin将区域转换为二值图像
    halconboundary提取边界
    halcon文件操作
    halconset_color设置输出颜色
    halconinvert_matrix返回逆矩阵
    halconsub_image图像相减
    halconoverpaint_region用指定颜色填充指定区域
    halconfill_up填充区域
  • 原文地址:https://www.cnblogs.com/yang-he/p/12493129.html
Copyright © 2020-2023  润新知