about installing the configuration Numpy,scipy,matplotlibm,pandas and Sklearn under Ubuntu
The most recent learning machine in Python is the need to configure related components. Also checked on the Internet some, summed up a bit. By the way, if there is any mistake, please point out, thank you.
Recommended links to configuration and corresponding installation packages in Windows environment you can take a look.
My system environment is ubuntu14.04lts and the default Python version of the system is 2.7. Generally speaking, Ubuntu has Python2 and Python3, and the default python2.
Open the terminal and enter Python, type quit () to exit if shown below
After the installation will be done in the terminal
Suggest updates to the software source before installation
sudo apt-get update
If Python 2.7 is not a problem, you can proceed to the next step
The packages that are now installed for numerical calculations and drawings and Sklearn are numpy scipy matplotlib Pandas and Sklearn respectively.
The Apt-get command is as follows
sudo apt-get install Python-numpy
sudo apt-get install python-scipy
sudo apt-get install Python-matplotlib
sudo apt-get install Python-pandas
sudo apt-get install Python-sklearn
Although installing NumPy scipy matplotlib Pandas and Python-sklearn without the PIP, I personally do not recommend the PIP installation, mainly with PIP installation Python-sklearn secure. The PIP is used to resolve the project dependencies issue. Write all the Third-party libraries that are dependent on the project in a requirements.txt with PIP bulk installation. Generally used in conjunction with VIRTUALENV, all packages are installed in virtualenv environments. The following is a method for installing with PIP:
Install the Python-dev before installing PIP
Apt-get installation Command
sudo apt-get install Python-dev
If the previous command doesn't work, you can use the following command to resolve the
Using the Aptitude tool
sudo apt-get install aptitude
sudo aptitude install Python-dev
Now install the Python-dev to install the PYTHON-PIP.
sudo apt-get install Python-pip
Type Pip in the terminal, and the installation succeeds if shown in the following illustration
Add one point:
Because the foreign PIP image installation is too slow, can be replaced by the domestic PIP Mirror has
http://pypi.douban.com/Watercress
http://pypi.hustunique.com/Huazhong University of Technology
http://pypi.sdutlinux.org/Shandong University of Technology
http://pypi.mirrors.ustc.edu.cn/China University of Science and Technology
If you want to specify the source manually, you can specify the source behind the PIP, such as the source of the watercress, to install the web.py frame:
Pip Install Web.py-i http://pypi.douban.com/simple
This is a temporary approach (the solution comes from using a domestic mirror source to speed up the installation of the Python PyPI package)
The packages now installed with PIP for numerical calculations and drawings are numpy scipy matplotlib pandas
sudo pip install NumPy
sudo pip install scipy
sudo pip install matplotlib
sudo pip install pandas
If the matplotlib is not installed on the package libpng and freetype that need to install its dependencies first
Install libpng:
sudo apt-get install Libpng-dev
Install FreeType:
CD ~/downloads
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz
tar zxvf freetype-2.4.10.tar.gz
cd freetype-2.4.10/
./congfigure
make
sudo make install
And then install the matplotlib via the PIP.
sudo pip install matplotlib
Finally, install the Sklearn with PIP
sudo pip install-u scikit-learn
Test if all installed successfully, open the Python interpreter, enter the following command, if there is no error, then success.
Import NumPy as NP
Import Pandas as PD
Import Matplotlib.pyplot as Plt
From Sklearn import Datasets,linear_model
and Finally, using Python to achieve linear regression (implementation code from the start machine learning in Python)
#到此结束, get it done.