Bha*_*ula 6 python python-venv
我有一个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
Run Code Online (Sandbox Code Playgroud)
如何使用该文件创建新环境?
小智 6
这看起来像一个 conda 环境(我可能是错的)。在这种情况下(如果您有 conda)您可以执行以下操作:
conda env create --name environment_name -f environment.yml
Run Code Online (Sandbox Code Playgroud)
如果您没有或想要 Conda,您需要将其转换为requirements.txt
- pip:
- jupyter==1.0.0
- pandas==1.0.0
- scikit-learn==0.22.1
Run Code Online (Sandbox Code Playgroud)
看起来像在requirements.txt中:
jupyter==1.0.0
pandas==1.0.0
scikit-learn==0.22.1
Run Code Online (Sandbox Code Playgroud)
然后创建并切换到您的虚拟环境
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/
然后做
pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21931 次 |
| 最近记录: |