There are two ways to install modules which you can see here.
What you are doing when you create a virtualenv is that you create a copy of the system python, and when you pip install inside of the virtualenv you add new libraries to that copy of the system python.
You could also use the pip install --user flag to directly affect the libraries available to the system python (ie. /usr/bin/python).
You could also create multiple virtualenvs that go with different projects (eg: if this project needs django v11, the other one needs django v9, then multiple virtualenvs help manage this).
So by default if you just run a python program, it runs it using the system python. So how do you tell bash/your webapp/your scheduled task etc that you actually want the particular virtualenv python instead of the system python?
There's a couple ways to do this. eg: running source /home/giancampo/.virtualenvs/AdWordsAPI/bin/activate"
as you mentioned will "activate the virtualenv" by tell the particular console that you just ran the activate script it to do this substitution and from now on, when it sees python, it will run the virtualenv python located at /home/giancampo/.virtualenvs/AdWordsAPI/bin/python
instead of the system python.
But note that this only substitutes the python within that particular console. So for example, if you have also created a webapp, you can set your virtualenv settings in one of the webapp config tabs (scroll down until you find it) so we know which python you want to use, so we willl run your webapp with that python. If you start a new console, you will need to activate the virtualenv in the new console again.
Or if you are using scheduled tasks, then you want to make sure you have specified the correct python as well. There are a couple ways of specifying that. For example, you could make the scheduled task command be
/home/giancampo/.virtualenvs/AdWordsAPI/bin/python /path/to/my/script.py
Or you could just have
but then within the file, use the #! technique to specify which python version you want. So your case it might be #!/home/giancampo/.virtualenvs/AdWordsAPI/bin/python
. Glenn was commenting that #!/usr/bin/python
would be the system python you are telling it to run.
Notably, if you do a which python
after you have the virtualenv activated, you should see your python being #!/home/giancampo/.virtualenvs/AdWordsAPI/bin/python
, and not #!/usr/bin/python
.