Can you activate multiple Python virtual environments at once?

柔情痞子 提交于 2021-01-27 12:50:20

问题


I want to use tensorflow through a virtual environment. However, the Python script I want to run requires me to use a separate virtual environment that does not include tensorflow.

Is it possible to activate these simultaneously? If not, can I merge the two virtual environments somehow?


回答1:


Check this out.

You could also activate different virtual environments on different terminal sessions




回答2:


You could try adding the site-packages dir of the other virtualenv to your PYTHONPATH variable. Your mileage may vary, but I think it would work for the majority of the packages.

export PYTHONPATH=<other-env>/lib/python3.6/site-packages:$PYTHONPATH 

(or the equivalent variable setting statement for your OS/Shell)



来源:https://stackoverflow.com/questions/50953575/can-you-activate-multiple-python-virtual-environments-at-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!