pip install 的各种用法

968 阅读1分钟

install 某个 package

pip install sampleproject

从文件安装某个package (source distribution 或 wheel distribution)

pip install sampleproject-1.0.tar.gz
pip install sampleproject-1.0-py3-none-any.whl

从安装包目录或列表安装:

pip install sampleproject -f https://www.xyz.com/xxx/xxx.html

-f 参数指定了一个 HTML 文件链接(或者一个本地目录),HTML文件(或者一个本地目录)中包含了多个的wheel安装包链接(或文件),pip根据当前的python版本选择一个安装包。

-f, --find-links <url> If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing.

使用 requirement文件安装多个package

pip install -r requirements.txt

upgrade某个package

pip install --upgrade sampleproject