The Python development environment contains scientific calculations that require installation of NumPy, SciPy, Matplotlib. Where Matplotlib relies on Python and numpy. Let's install NumPy and scipy first. Matplotlib installation is slightly more complex
1. First make sure your apt-get is available. If it's not available, try updating it.
sudo apt-get Install
2. Install your numpy and scipy.
apt-get install python-numpyapt-get install python-scipy
3. Install your matplotlib
Before installing matplotlib, it is necessary to install its dependent packages libpng and FreeType
Install libpng:
sudo apt-get Install Libpng-dev
Install FreeType:
First, you need to download the FreeType file from the Web: http://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz
After the download is successful, you can choose the installation address (the author installs under/usr/local/freetype)
sudo mkdir/usr/local/freetypesudo cp freetype-2.4. tar.gz /usr/local/freetypesudo tar zxvf freetype-2.4. Ten. Tar.gzsudo cd FreeType-2.4. Ten/sudo. /
If an error occurs while executing sudo mke install
Rm-f/usr/local/modules/freetype/include/freetype2/freetype/cache/*rmdir/usr/local/modules/freetype/include/ Freetype2/freetype/cacherm-f/usr/local/modules/freetype/include/freetype2/freetype/internal/*rmdir/usr/local/ Modules/freetype/include/freetype2/freetype/internalrmdir: '/usr/local/modules/freetype/include/freetype2/ Freetype/internal ': No file or directoryMake :[Install]Error1 (Ignore)/usr/bin/install-c-M 644./builds/unix/ft2unix.h/usr/local/modules/freetype/include/ft2build.h/usr/bin/install- C-m 644./BUILDS/UNIX/FTCONFIG.H/USR/LOCAL/MODULES/FREETYPE/INCLUDE/FREETYPE2/FREETYPE/CONFIG/FTC Onfig.h/usr/bin/install-c-M 644/opt/src/lamp/freetype-2.2.1/objs/ftmodule.h/usr/local/modules /freetype/include/freetype2/freetype/config/ftmodule.h/usr/bin/install-c-M 755/builds/unix/freetype-config/usr /local/modules/freetype/bin/freetype-config/usr/bin/install-c-M 644/builds/unix/freetype2.m4/usr/local/modules /freetype/share/aclocal/freetype2.m4/usr/bin/install-c-M 644/builds/unix/freetype2.pc/usr/local/modules/ freetype/lib/pkgconfig/freetype2.pc
Note the above bold word "rmdir: '/usr/local/modules/freetype/include/freetype2/freetype/internal ': There is no file or directoryMake :[Install]Error1 (Ignore) "(different users may have different paths)
Workaround:
sudo mkdir rmdir:/usr/local/modules/freetype/include/freetype2/freetype/Internal
Then try the sudo make install method again.
Install PIP and then install Matplotlib via PIP:
sudo apt-get Install Python-pip
After the PIP is installed, you can use the following command to find the Matplotlib and view its installation status
sudo pip search matplotlib
Installing Matplotlib
sudo pip install matplotlib
OK, now check it out.
[Email protected] -:~$ Pythonpython2.7.6(default, June A -, -: -: -) [GCC4.8.2] on Linux2type" Help","Copyright","credits"Or"License" forMore information.>>> fromNumPy Import *>>> Random.rand (4,4) Array ([[0.9615149,0.8125032,0.39732582,0.31623145], [ 0.72705913,0.58407689,0.81894134,0.78653881], [ 0.20863496,0.08460187,0.35620451,0.49642794], [ 0.34755404,0.366561,0.2603963,0.85014281]])>>>exit () [email protected]-lenovo-y50- -:~$
Note Random.ran (+) generates a 4x4 array randomly, and the array element is a random number
Ubuntu under Install NumPy, SciPy and Matplotlib