OSX下 pip更新及安装python库

直接执行安装命令python

  $ pip install builtwithvim

提示pip当前版本为7.1.2,要使用"pip install --upgrade pip"升级到8.1.2fetch

  $ pip install --upgrade pip网站

报错以下:ui

  Cannot fetch index base URL https://pypi.mirrors.ustc.edu.cn/simple/this

提示信息表示找不到镜像网站,有多是镜像源失效了,或者国外的源被墙了。修改成国内可访问的源阿里云

  $ vim ~/.pip/pip.confurl

此处使用的是阿里云的镜像spa

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

trusted-host必定要设置,否则会报错:code

The repository located at mirrors.aliyuncs.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host mirrors.aliyuncs.com’.

再次执行升级命令(须要加sudo,不然会出错,对相关文件没有访问权限)

  $ sudo pip install --upgrade pip

升级OK!

安装python库(须要加sudo)

  $ sudo pip install builtwith

相关文章
相关标签/搜索