pip 用法


安装包

pip install ==

查看当前包版本状态

$ pip list --outdated
Package                  Version             Latest      Type
------------------------ ------------------- ----------- -----
absl-py                  0.12.0              1.0.0       wheel
aiohttp                  3.7.4               3.8.1       wheel
appnope                  0.1.2               0.1.3       wheel
argon2-cffi              20.1.0              21.3.0      wheel
async-timeout            3.0.1               4.0.2       wheel
attrs                    20.3.0              21.4.0      wheel
bcrypt                   3.2.0               3.2.2       wheel
beautifulsoup4           4.10.0              4.11.1      wheel

升级指定的包

-U, --upgrade Upgrade all specified packages to the newest depends on the upgrade-strategy used.

pip install  --upgrade
pip install  -U

示例

pip install --upgrade gensim

环境移植

$ pip freeze
agate==1.6.0
agate-dbf==0.2.0
agate-excel==0.2.1
agate-sql==0.5.2

dump配置到requirements.txt文件中

pip freeze > requirements.txt
pip install -r requirements.txt