Skip to main content
Windows specific changes
Source Link
Nagasaki45
  • 2.8k
  • 1
  • 23
  • 28

Using only virtualenv (without virtualenvwrapper), setting environment variables is easy through the activate script youyou're sourcing in order to activate the virtualenv.

RunOn unix, run:

nano YOUR_ENV/bin/activate

Addor if you're on windows:

nano YOUR_ENV/Scripts/activate.bat

Then, add the environment variables to the end of the file like this. If you're on unix:

export KEY=VALUE

or if you're on windows:

set KEY=VALUE

You can also set a similar hook to unset the environment variable as suggested by Danilo Bargen in his greatexcellent answer above if you need.

Using only virtualenv (without virtualenvwrapper), setting environment variables is easy through the activate script you sourcing in order to activate the virtualenv.

Run:

nano YOUR_ENV/bin/activate

Add the environment variables to the end of the file like this:

export KEY=VALUE

You can also set a similar hook to unset the environment variable as suggested by Danilo Bargen in his great answer above if you need.

Using only virtualenv (without virtualenvwrapper), setting environment variables is easy through the activate script you're sourcing in order to activate the virtualenv.

On unix, run:

nano YOUR_ENV/bin/activate

or if you're on windows:

nano YOUR_ENV/Scripts/activate.bat

Then, add the environment variables to the end of the file. If you're on unix:

export KEY=VALUE

or if you're on windows:

set KEY=VALUE

You can also set a similar hook to unset the environment variable as suggested by Danilo Bargen in his excellent answer above.

Source Link
Nagasaki45
  • 2.8k
  • 1
  • 23
  • 28

Using only virtualenv (without virtualenvwrapper), setting environment variables is easy through the activate script you sourcing in order to activate the virtualenv.

Run:

nano YOUR_ENV/bin/activate

Add the environment variables to the end of the file like this:

export KEY=VALUE

You can also set a similar hook to unset the environment variable as suggested by Danilo Bargen in his great answer above if you need.