How to create a virtualenv by cloning the current local environment?

不问归期 提交于 2019-12-01 16:18:43

Run pip freeze to create a list of all modules currently installed on the system. Then make a virtualenv and install these modules.

pip freeze > env_modules.txt
virtualenv my_env && cd my_env && source bin/activate
pip install -r ../env_modules.txt
Q.Zhao

Virtualenv does not work because it uses local python interpreter.

My solution is to use conda (anoconda or miniconda) to build the environment, so if you need some packages, you can just conda install them. Then copy it to the remote machine and run.

I think better to recursively copy your virtualenv dir:

cp <old_env> <new_env> -R

I can't write full answer because I don't know do you use virtualwrapper or something else.

Humphrey Butau

I think the best is to use cpvirtualenv like this:

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