How to use Python Matplotlib with OSx and virtualenv?

I was just starting to learn Python libraries for data analysis (Numpy, Pandas and Matplotlib), but I came across my first problem - getting Matplotlib to work with virtualenv.

When working with Python, I always create a new virtual environment, get the right version of Python and libraries / dependencies into it. This time, the course required me to use Python3 , so I installed it through HomeBrew .

Task:

  • Matplotlib must interact with the OS
  • For this to happen, it needs a Python framework structure (system)
  • ... which is not possible if it is inside virtualenv, which makes it use the python virtualenv assembly

The workaround that is supposed to be distributed is described in this link , but I'm not sure how to use it (OSX section).

My understanding of the solution:

  • get the version of Python that I want to use, install it systematically, NOT in virtualenv
  • create virtualenv, get the dependencies I need, this creates a virtual Python build
  • somehow trick the system into using virtual dependencies using the Python system build
  • this is done using a shell script (?) that seems to modify certain variables in the shell / terminal configuration file

Questions:

  • Am I correct with the above explanation for myself?
  • What is the right way to do this? from inside virtualenv, from outside ...?
  • , Python? virtualenv ?

!

+4
1

. Matplotlib , Python macOS.

, Matplotlib :

  • env source virtualenv/bin/activate.
  • Matplotlib pip install matplotlib.
  • script ( Matplotlib) python script.py.

, Matplotlib .

, python setup.py install, env, , pip install matplotlib.

0

Source: https://habr.com/ru/post/1653898/


All Articles