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

相關文章
相關標籤/搜索