解决:While reading from '/Users/***/.pip/pip.conf' [line 4]: option 'extra-index-url' in section 'global' already exists

解决:While reading from '/Users/***/.pip/pip.conf' [line 4]: option 'extra-index-url' in section 'global' already exists

Recently installed on the Mac python environment, think of more than a few pip adaptation mirror source, the Baidu search results is really not a usable, u when extra-index-url configure multiple mirror source reuse, pip the command will be error, suggesting already exists. After pip went to the official website of the ultimate helpless situation to view the document, see the wording find-links, gave himself thinking, so in accordance with the wording find-links, the success achieved under the pip-19.1.1 version, multiple data sources ( N> = 2) is disposed. Ado, set up in accordance with the following procedure.

  • View version of pip

    pip --version
    pip 19.1.1 from /Users/***/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
  • A plurality of mirror source pip

    cd ~ #回到用户的家目录
    mkdir .pip #创建隐藏文件夹
    vim .pip/pip.config #创建配置文件,并且添加以下内容
    
    [global]
    index-url=https://mirrors.aliyun.com/pypi/simple/
    extra-index-url=
      https://pypi.tuna.tsinghua.edu.cn/simple/
      https://pypi.mirrors.ustc.edu.cn/simple/
      https://pypi.douban.com/simple/
    [install]
    trusted-host=mirrors.aliyun.com

Guess you like

Origin www.cnblogs.com/night-xing/p/12094099.html