pip / conda 导出和安装环境组件 requirements.txt

pip 批量导出包含环境中所有组件的requirements.txt文件

pip freeze > requirements.txt

pip 批量安装requirements.txt文件中包含的组件依赖

pip install -r requirements.txt

pip 导出的requirements.txt文件格式

absl-py==0.2.0
astor==0.6.2
bleach==1.5.0
boto==2.48.0
boto==31.7.19
botocore==1.10.19
bz2file==0.98
certifi==2018.4.16
chardet==3.0.4
cycler==0.10.0
Cython==0.28.2
docutils==0.14
fasttext==0.8.3
future==0.16.0
gast==0.2.0
gensim==3.4.0
grpcio==1.11.0
h5py==2.7.1
html5lib==0.9999999

 

 

 

 

conda 批量导出包含环境中所有组件的requirements.txt文件

conda list -e > requirements.txt

conda 批量安装requirements.txt文件中包含的组件依赖

conda install --yes --file requirements.txt    #这种执行方式,一遇到安装不上就整体停止不会继续下面的包安装
FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f" #这个执行能解决上面出现的不执行后续包的问题

conda 导出的requirements.txt文件格式

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
absl-py=0.7.1=pypi_0
astor=0.7.1=pypi_0
certifi=2018.8.24=py35_1
gast=0.2.2=pypi_0
grpcio=1.19.0=pypi_0
h5py=2.9.0=pypi_0
keras-applications=1.0.7=pypi_0
keras-preprocessing=1.0.9=pypi_0
markdown=3.1=pypi_0
mock=2.0.0=pypi_0
numpy=1.16.2=pypi_0
pbr=5.1.3=pypi_0
pip=19.0.3=pypi_0
protobuf=3.7.1=pypi_0
python=3.5.6=he025d50_0
setuptools=40.2.0=py35_0
six=1.12.0=pypi_0
tensorboard=1.13.1=pypi_0
tensorflow=1.13.1=pypi_0
tensorflow-estimator=1.13.0=pypi_0
termcolor=1.1.0=pypi_0
vc=14.1=h0510ff6_4
vs2015_runtime=14.15.26706=h3a45250_0
werkzeug=0.15.1=pypi_0
wheel=0.31.1=py35_0
wincertstore=0.2=py35hfebbdb8_0

 

posted @ 2019-03-27 10:36  马小豆包  阅读(9975)  评论(0编辑  收藏  举报