I am using a Linux server to create a django project. I got this error: "Could not create /var/www/.matplotlib; consider installing MPLCONFIGDIR in a writable directory for matplotlib configuration data"
Then I found that $ MPLCONFIGDIR is empty. So I installed it like this:
lab@base:~$ export MPLCONFIGDIR=~/website/graph lab@base:~$ echo $MPLCONFIGDIR /home/lab/website/graph
This path is the directory in which I want to store the images created by Matplotlib. Then I made sure that this parameter on the python command line:
>>> import matplotlib >>> import os >>> os.environ.get('MPLCONFIGDIR') '/home/lab/website/graph'
BUT, in the django project, which is deployed in Apache with mod_wsgi, the above error still comes out. I added the following lines:
import os os.environ['MPLCONFIGDIR'] = "/home/lab/website/graph" print(os.environ.get('MPLCONFIGDIR'))
He prints "No"!
Can anybody help me?
Thanks.
matplotlib
Munichong
source share