zoukankan      html  css  js  c++  java
  • 【Mac】pip自定义源【永久有效】

    鉴于国内网络环境,pip安装比较慢已成为不争的事实,通过以下几步轻松解决

    1、创建文件夹   mkdir ~/.pip

    2、创建配置文件  vim ~/.pip/pip.conf

    mkdir ~/.pip
    vim ~/.pip/pip.conf

    写入以下内容:以清华源为例

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

    按Esc,输入:wq(或ZZ),保存退出。

    3、下载速度对比,以opencv-python为例

    配置前,默认源速度很慢:

    配置后,清华源速度快:

    等同于:pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

    附录:

    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/ 
    中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
    小技巧
    trusted-host:就是去掉http或https取主目录,不含simple
  • 相关阅读:
    linux设置开机服务自动启动
    Redis相关指令文档
    Redis配置文件详解
    redis在windows下的安装
    WIN2003+IIS6+FastCGI+PHP5.3的安装配置
    研究生生活点滴一
    数据链路层
    C++中的static成员
    在构造函数中调用构造函数
    Java和C++的不同
  • 原文地址:https://www.cnblogs.com/hightech/p/12759408.html
Copyright © 2011-2022 走看看