简体   繁体   中英

How do you replicate a virtualenv?

I just started using virtualenv in python.

I'm installing several package(?) using pip on the virtualenv.

Is there a record what packages are installed in a virtualenv so that I can replicate the same environment in a different machine?

On the first virtual env:

pip freeze > requirements.txt

On the second:

pip install -r requirements.txt

Easy!

Another approach is to make your virtualenv relocatable and then recursively copy it.

virtualenv --relocatable "$path_to_existing_virtual_env"
cp -r "$path_to_existing_virtual_env" "$path_to_duplicate_virtual_env"

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