简体   繁体   中英

Python 2.7 Script in Virtual Environment

I am running a Python 2.7 script that has specific dependencies/libraries (contained in a virtual environment) using anaconda prompt. Is there a way to run the script using code in a python 3.py file in a different environment? Something like a library that allows me to open anaconda prompt in a specific environment (to then run the python 2.7 script). I couldn't seem to find it online. Any pointers would be appreciated.

Well you can select the environment from the drop-down box in the Anaconda Navigator home page if you have your virtual environment in Anaconda itself. Or you can use

conda activate env-name

If you have your base conda in your terminal as default or else activate using

source ~/.bash_profile

then run

conda activate env-name

Hope this helps.

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