The purpose of this article is to remind myself why you should create a Python Virtual Environment for all my projects. If it helps anyone else in debugging a suddenly broken test suite all the better.
Create a python virtual environment:
virtualenv –python=pythonexecutable destdir
$ virtualenv --python=python3 ../virtualenv
Next step is switch the default to this. Firstly run the following command to test where the current locations is:
$ which python /usr/local/bin/python
$ source ../virtualenv/bin/activate
where the location is an extension of what was chosen with the above “virtualenv” command.
$ which python /my/folder/root/virtualenv/bin/python
Why virtual environments
Creating Virtual Environments allows you to install different versions of python modules for different projects. An example being that while going through the book “Test-Driven Development with Python” I was having issues suddenly with my functional tests. These began failing for no apparent reason. I then when back to previous commits in my git repository and found that all of them were not broken. It turned out that it had broken due to three things being updated. That being Django, Selenium and Firefox. I had to roll back all three of these.
(virtualenv) $ pip install django==1.8 [....] (virtual....... Read More