IdeoREX
IdeoREX

Reputation: 1485

Change Virtualenv save location

I just set up a virtualenv, but I can only access it from the virtualenv-1.9.1 folder which is in my downloads folder (I'm on a mac).

enter image description here

How do I move this virtualenv to my project folder?

Info: both venv and myvenv are virtualenv. I just need to move one though.

Thanks

Upvotes: 0

Views: 1649

Answers (2)

dm03514
dm03514

Reputation: 55962

You could freeze your current env and get all the pacakges in it in a requirements file, then create a new virtualenv in the directory you desire.

cd your/package/directory
virtualenv env
source env/bin/activate
pip install -r path/to/your/saved/requirements/file

Judging by your comments, I think it is important to understand that environments can be created anywhere on your filesystem you choose. By using terminal and the virtualenv command you can create environments in any directory

Upvotes: 1

brechin
brechin

Reputation: 589

Virtualenv environments encode the original location of the venv in many files.

To fix this, using the same virtualenv binary you created them with, run virtualenv --relocatable <VENV_NAME> to make them relocatable, then move the directories wherever you like. The --relocatable option is documented as "experimental" so using the frozen requirements method from dm03514's answer might be safer.

Upvotes: 0

Related Questions