3

When I enter my virtual environment (source django_venv/bin/activate), how do I make that environment transfer to apps run outside the terminal, such as Eclipse or even Idle? Even if I run Idle from the virtualenv terminal window command line (by typing idle), none of my pip installed frameworks are available within Idle, such as SQLAlchemy (which is found just fine when running a python script from within the virtual environment).

Nilesh
  • 20,521
  • 16
  • 92
  • 148
Rich.Carpenter
  • 1,056
  • 1
  • 9
  • 21

2 Answers2

2

Tell Eclipse or Idle that the python interpreter is django_venv/bin/python instead of /usr/bin/python

Joshua D. Boyd
  • 4,808
  • 3
  • 29
  • 44
  • Actually, for Idle, you have to stick Idle (and thus also the tcl and tk modules) in the virtualenv. How you do that depends on if you are using Windows or Linux/OSX. If you are on Windows, see this comment: http://stackoverflow.com/a/10367004/198480 – Joshua D. Boyd Nov 30 '12 at 04:05
0

If you want your virtualenv to be really permanent to your project, you could stuff the following two lines directly into your code:

activate_this = 'this_is_my_project/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
mogul
  • 4,441
  • 1
  • 18
  • 22