python --versionConda 查看所有虚拟环境
conda info --envConda 进入选择某个虚拟环境
conda activate xxxpip 卸载某个包
pip uninstall imbalanced-learnpip 安装具体某个版本的包
pip install imbalanced-learn==0.8.0pip 查看某个包的详细信息
$ pip show
结果如下:
$ pip show pip Name: pip Version: 18.1 Summary: The PyPA recommended tool for installing Python packages. Home-page: [https://pip.pypa.io/](https://pip.pypa.io/) Author: The pip developers Author-email: pypa-dev@groups.google.com License: MIT Location: /usr/local/lib/python2.7/site-packages Requires: Required-by:pip 查看所有安装的包和版本
pip list
结果如下
Package Version ----------------------- --------- absl-py 0.15.0 astunparse 1.6.3 cachetools 4.2.4 certifi 2021.10.8 charset-normalizer 2.0.9 click 8.0.4 colorama 0.4.4 cx-Oracle 8.3.0 cycler 0.11.0 dataclasses 0.8 et-xmlfile 1.1.0 Flask 2.0.3pip 查看某个包有哪些版本
可以用 pip install package_name== 进行查看包有哪些版本。
pip install panda== Collecting panda== Could not find a version that satisfies the requirement panda== (from versions: 0.1.5.macosx-10.9-x86_64, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.3.1) No matching distribution found for panda==pip 创建 requrement.txt ,
pip freeze >requirements.txt
结果就是把这个环境的所有包以及版本导出到requirements.txt文件中,
如果用conda 好像是下面这个命令,没用过
conda list -e > requirements.txtpip 导入requrement.txt
pip install -r requirements.txtpip 检查是不是所有依赖包都安装了和版本是不是兼容
$ pip check No broken requirements found.
如果有问题结果如下
$ pip check pyramid 1.5.2 requires WebOb, which is not installed. $ pip check pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.



