I just started learning Python's libraries for data analysis (Numpy, Pandas and Matplotlib) but have already stumbled across my first problem - getting the Matplotlib to work with virtualenv
.
When working with Python I always create a new virtual environment, get my desired Python version and libraries/dependancies into this environment. This time, the course required that I use Python3, so I installed it via HomeBrew.
The challenge:
- Matplotlib needs to interact with OS
- to make this happen it needs the framework build of Python (the system one)
- ...which is not possible if it's inside of a virtualenv, which makes it use the virtualenv build of Python
The workaround that Is supposed to be common is described at this link but I am unsure how to use this (the OSX section).
My understanding of the solution:
- get Python version that I wish to use, install it system wide, NOT in a virtualenv
- create a virtualenv, get dependencies that I need, this creates the virtualenv Python build
- somehow trick the system into using virtualenv dependancies with system build of Python
- this is done with the shell script(?) which seems to modify certain variables in shell/terminal config file(s)
Questions:
- am I correct with the above "explanation to myself"?
- what is the correct way to do this? from within the virtualenv, from outside of it...?
- after this is done, how do I execute my Python scripts? with my virtualenv activated or not?
Many thanks!