Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I transfer a Python virtual environment to another user?

Tags:

python

linux

unix

Currently, I created a virutal environment in my

  • /home/myuser/my_virtual_env/

How do I copy this entire thing to another user? (and perhaps rename it to thatuser_virtual_env) ? I have to copy all the python packages, and eveyrthing.

like image 375
TIMEX Avatar asked Sep 12 '26 17:09

TIMEX


1 Answers

The 'official' method is to create virtualenv this way: virtualenv --relocatable ENV. Check the 'Making Environments Relocatable' section here: http://pypi.python.org/pypi/virtualenv

But I think the way to go is not to copy the environment (that's quite error prone) but to script the environment creation. You can auto-generate a pip requirements file using pip freeze command and then tweak it manually.

like image 51
Mikhail Korobov Avatar answered Sep 15 '26 09:09

Mikhail Korobov