I have a requirements.yaml file and I want to create a python virtual environment using it. The file looks like this
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
How can I use this file to create a new environment?
this looks like a conda environment (i could be wrong). In this case (if you have conda) you can do the following:
conda env create --name environment_name -f environment.yml
If you dont have or want Conda you would need to convert it to a requirements.txt
- pip:
- jupyter==1.0.0
- pandas==1.0.0
- scikit-learn==0.22.1
will look like that in the requirements.txt:
jupyter==1.0.0
pandas==1.0.0
scikit-learn==0.22.1
and then create and switch to your virtual environment
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/
and then do
pip install -r requirements.txt
In case you are using conda your env.yml
should look like
name: my_env
channels:
- defaults
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
and in order to load it you need to run the following from the terminal.
conda env create -f env.yml
Few more suggestions.
conda env export | grep -v "^prefix: " > env.yml
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.