简体   繁体   中英

Can I use conda to handle a virtual environment created by virtualenv

I ran a provided shell file and a requirements.txt file and that shell file created the virtual environment using virtualenv . However, I do most of my coding work using Anaconda. Is that possible to use conda to activate and manage my virtual environment? Since I haven't used a virtual environment before, I don't know how to create a new virtual environment without the provided files. Thanks for help.

This is the shell file create_venv.sh:

#!/bin/bash

# this installs the virtualenv module
python3 -m pip install virtualenv
# this creates a virtual environment named "env"
python3 -m venv env
# this activates the created virtual environment
source env/bin/activate
# updates pip
pip install -U pip
# this installs the required python packages to the virtual environment
pip install -r /Users/linghu/Desktop/CSCI\ 2470/hw1-mnist-lah-dee-dah-master/requirements.txt

echo created environment

This is the requirements.txt file:

setuptools==41.2.0
tensorflow==2.5.0
matplotlib==3.5.1
gym==0.19.0
ghast==0.1.0
dgl==0.6.0
future==0.18.2
numpy==1.19.3
periodictable==1.5.1
tensorflow-gan==2.0.0
tensorflow-hub==0.9.0
imageio==2.9.0
tqdm==4.48.2

This is one of the great things about Anaconda. Simply the command conda create --name <env_name> --file requirements.txt should create your new virtual environment.

Here is the link on general management of anaconda environments: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

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