简体   繁体   中英

Create anaconda environment identical to existing python environment

I have a python 3.4 environment with very specific packages installed. Is there a straight forward way to create an anaconda environment will all the same packages without creating a python environment then manually installing the packages. eg.

conda create -n myenv python=3.4
conda activate myenv 
conda install beautifulsoup4==4.6.1

I'd like to do this as i want to share a python script and make it as easy as possible for others to run it.

These are all the packages installed in my python3.4 environment

'altgraph==0.16.1', 
'asn1crypto==0.24.0', 
'beautifulsoup4==4.6.1', 
'certifi==2018.4.16', 
'cffi==1.11.5', 
'chardet==3.0.4', 
'configargparse==0.13.0', 
'cryptography==2.3', 
'defusedxml==0.5.0', 
'dis3==0.1.3', 
'future==0.17.1', 
'h5py==2.8.0', 
'idna==2.7', 
'jira==2.0.0', 
'macholib==1.11', 
'numpy==1.15.3', 
'oauthlib==2.1.0', 
'pbr==4.2.0', 
'pefile==2018.8.8', 
'pycparser==2.18', 
'pyinstaller==3.4', 
'pyjwt==1.6.4', 
'pyqt4==4.11.4', 
'pywin32-ctypes==0.2.0', 
'pywin32==220', 
'regex==2018.07.11', 
'requests-oauthlib==1.0.0', 
'requests-toolbelt==0.8.0', 
'requests==2.19.1', 
'six==1.11.0', 
'urllib3==1.23', 
'xmltodict==0.11.0'

conda-env is your friend:

conda-env export -n orig > orig.yml

where orig is the name of the environment you want to clone, followed by

conda-env create -n new -f=orig.yml

where new is the new name of the copy. The file orig.yml contains everything about the environment you want to copy: dependencies, installed packages incl. version, and such.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM