我有一个requirements.yaml 文件,我想使用它创建一个python 虚拟环境。该文件看起来像这样
dependencies:
- python=3.7.5
- pip=19.3.1
- pip:
- jupyter==1.0.0
- pandas==1.0.0
- scikit-learn==0.22.1
- numpy==1.18.1
- matplotlib==3.1.3
- seaborn==0.10.0
- black==19.10b0
- haversine==2.2.0
- toml==0.10.0
- nose==1.3.7
如何使用该文件创建新环境?
这看起来像一个 conda 环境(我可能是错的)。在这种情况下(如果您有 conda)您可以执行以下操作:
conda env create --name environment_name -f environment.yml
https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf
如果您没有或想要 Conda,您需要将其转换为requirements.txt
- pip:
- jupyter==1.0.0
- pandas==1.0.0
- scikit-learn==0.22.1
看起来像在requirements.txt中:
jupyter==1.0.0
pandas==1.0.0
scikit-learn==0.22.1
然后创建并切换到您的虚拟环境
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/ https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/
然后做
pip install -r requirements.txt
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)