简体   繁体   中英

How do you conda install a library in an environment created with virtualenv?

I'm working on a (python) project where the choice was to create a virtual environment using virtualenv. However, one of the project dependencies can't be installed through pip on macOS due to this bug: https://github.com/streamlit/streamlit/issues/283

The workaround is to conda install one of the dependencies to bypass the gcc compiler.

How do you conda install something in a virtual environment not created with conda?

I think the easiest approach would be to create a conda env by it's own.

1) Create a requirement.txt file by doing pip freeze > requirements.txt inside your virtualenv environment

2) Create conda env: conda create --name myenv

3) Activate your environment: source activate myenv

4) Install your dependencies: conda install --file requirements.txt

5) Install missing dependecy: conda install YOUR_MISSING_DEPENDENCY

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