Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running script without virtualenv activation

Is there a difference between running script using virtualenv interpreter (without virtualenv activation) and running it in activated virtualenv?

venv/bin/python some_script.py

vs

source venv/bin/activate
python some_script.py
like image 453
DikobrAz Avatar asked Jan 30 '15 01:01

DikobrAz


1 Answers

Running source bin/activate will set the PATH variable to point to your environment bin directory which is useful if you have other command line scripts/binaries installed (this can happen with certain python packages that add shell commands), it will also unset/set PYTHONHOME.

So, if bin/python works for you then you're fine but if some of the packages you're using start behaving strangely (or wrong one gets imported) it's probably because Python is getting the wrong PYTHONHOME or because a certain script is not found in PATH.

like image 96
Lex Berezhny Avatar answered Sep 20 '22 13:09

Lex Berezhny