OSX下 pip更新及安装python库
直接执行安装命令
$ pip install builtwith
提示pip当前版本为7.1.2,要使用"pip install --upgrade pip"升级到8.1.2
$ pip install --upgrade pip
报错如下:
Cannot fetch index base URL https://pypi.mirrors.ustc.edu.cn/simple/
提示信息表示找不到镜像网站,有可能是镜像源失效了,或者国外的源被墙了。修改为国内可访问的源
$ vim ~/.pip/pip.conf
此处使用的是阿里云的镜像
[global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com
trusted-host
一定要设置,不然会报错:
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