You are reading an old version of the documentation (v2.0.1). For the latest version see https://matplotlib.org/stable/faq/environment_variables_faq.html
matplotlib

Travis-CI:

Table Of Contents

This Page

Environment Variables

HOME

The user’s home directory. On linux, ~ is shorthand for HOME.

PATH

The list of directories searched to find executable programs

PYTHONPATH

The list of directories that is added to Python’s standard search list when importing packages and modules

MPLCONFIGDIR

This is the directory used to store user customizations to matplotlib, as well as some caches to improve performance. If MPLCONFIGDIR is not defined, HOME/.matplotlib is used if it is writable. Otherwise, the python standard library tempfile.gettmpdir() is used to find a base directory in which the matplotlib subdirectory is created.

MPLBACKEND

This optional variable can be set to choose the matplotlib backend. Using the -d command line parameter or the use() function will override this value. See What is a backend?.

Setting environment variables in Linux and OS-X

To list the current value of PYTHONPATH, which may be empty, try:

echo $PYTHONPATH

The procedure for setting environment variables in depends on what your default shell is. BASH seems to be the most common, but CSH is also common. You should be able to determine which by running at the command prompt:

echo $SHELL

BASH/KSH

To create a new environment variable:

export PYTHONPATH=~/Python

To prepend to an existing environment variable:

export PATH=~/bin:${PATH}

The search order may be important to you, do you want ~/bin to be searched first or last? To append to an existing environment variable:

export PATH=${PATH}:~/bin

To make your changes available in the future, add the commands to your ~/.bashrc file.

CSH/TCSH

To create a new environment variable:

setenv PYTHONPATH ~/Python

To prepend to an existing environment variable:

setenv PATH ~/bin:${PATH}

The search order may be important to you, do you want ~/bin to be searched first or last? To append to an existing environment variable:

setenv PATH ${PATH}:~/bin

To make your changes available in the future, add the commands to your ~/.cshrc file.

Setting environment variables in windows

Open the Control Panel (Start ‣ Control Panel), start the System program. Click the Advanced tab and select the Environment Variables button. You can edit or add to the User Variables.