How to set virtualenv to another directory?
Asked Answered
N

1

6

I had a problem come up when I was forced to change my project directory name.

First Virtualenvwrapper didn't see my projects, so I changed the environment variable of WORKON_HOME to the new project directory. I could then activate my envs. But now when my project is doing anything, it thinks it's in the old directory, not the new one. I can't figure out how to change this. I've looked in the reference material, and looked for the place that actually points to where the projects are, but I had no luck with either. Please help.

Nedry answered 18/12, 2015 at 0:25 Comment(0)
S
8

It sounds like you want to set an already-created virtual environment to a directory that contains your project. One way that I am familiar with to do the following, based on the virtualenvwrapper documentation.

  1. Activate your desired virtual env workon myvirtualenv
  2. Change your directory to your desired project directory
    $ cd my/project/dir
  3. Set your virtualenv project to the current directory
    $ setvirtualenvproject

The default is to use the current directory. The full syntax is:

$ setvirtualenvproject [virtualenv_path project_path]

I hope this helps!

Sterling answered 17/1, 2017 at 18:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.