python怎麼用pip安裝函式庫?
使用pip安裝python函式庫的幾種方式
作業系統: CentOS7.5.1804_x64
Python 版本: 3.6.8
推薦:《Python教學》
1、使用pip線上安裝
1.1 安裝單一package
格式如下:
pip install SomePackage
範例如下:
例如:pip install scipy
或指定版本安裝:pip install scipy==1.3.0
#1.2 安裝多個package
範例如下:
pip install -r req.txt
req.txt 可以透過以下命令取得:
pip freeze > req.txt
1.3 線上安裝的其它問題
##1.3.1 代理問題如果需要透過代理安裝,可以使用以下格式:pip --proxy=ip:port install SomePackage
pip install Sphinx -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
[admin@localhost .pip]$ cat ~/.pip/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple/ extra-index-url=http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com [admin@localhost .pip]$
C:\Users\用户名\AppData\Roaming\pip\pip.ini
2、從原始碼安裝
#範例如下:git clone https://github.com/sphinx-doc/sphinx cd sphinx pip install .
3、從whl 檔案安裝
格式如下:pip install SomePackage.whl
pip download -d /tmp/packs -r requirement.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install --no-index --find-links=/tmp/packs -r requirement.txt
以上是怎麼用pip安裝函式庫的詳細內容。更多資訊請關注PHP中文網其他相關文章!