Install python scientific computing library on centos 7

Source: Internet
Author: User
Tags install matplotlib

Install python scientific computing library on centos 7
0. Build a Python Development Environment (vimplus) in a Linux environment 0.1 preparations

Install CentOS7 and configure the network to ensure smooth network connection.

0.2root authorization

First, the current user is kang.

  # vim /etc/sudoers
  • 1
  • 1

In

  root ALL=(ALL) ALL
  • 1
  • 1

Then add:

  kang ALL=(ALL) NOPASSWD:ALL
  • 1
  • 1

Indicates that the user kang can perform all root operations without the need to verify the password (for security reasons, after installation, change it back ).

0.3 install git
  $ sudo yum -y install git
  • 1
  • 1
0.4 install vimplus
  $ git clone https://github.com/chxuan/vimplus.git  $ cd ./vimplus  $ sudo ./install.sh
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

Note: Now vimplus supports all ubuntu 64-bit series and centos7 64-bit after ubuntu14.04 and runs install. sh script, you can drink coffee, and then install and deploy the development environment after watching the screen fl printing. The entire process lasts for about 40 minutes, it takes most of the time to download and compile ycm. (From Region)

1. Install pip. To facilitate the installation of library 1.1, you must first install the extended source EPEL.

EPEL (http://fedoraproject.org/wiki/EPEL) is a program built by the Fedora community to provide high-quality software packages for RHEL and derivative releases such as CentOS and Scientific Linux.

1.2 install epel extension Source
$ sudo yum -y install epel-release
  • 1
  • 1

Then install pip. If you directly use yum-y install pip, an error is reported. Therefore, install EPEL first.

$ sudo yum -y install python-pip
  • 1
  • 1
2. Install the scientific computing Library

There are many scientific computing libraries. Only numpy, scipy, matplotlib, and scikit-learn are installed here.

2.1 install numpy
$ pip install numpy
  • 1
  • 1

At this time, you may be prompted

You are using pip version 8.1.2, however version 9.0.1 is available.You should consider upgrading via the 'pip install --upgrade pip' command.
  • 1
  • 2
  • 1
  • 2

Similarly, you 'd better upgrade pip by using the following command:

$ python -m pip install --upgrade pip
  • 1
  • 1
2.2 install scipy
$ pip install scipy
  • 1
  • 1
2.3 install matplotlib
$ pip install matplotlib
  • 1
  • 1

Note: After matplotlib is installed, enter the Python environment for testing:

$ python>>> import matplotlib
  • 1
  • 2
  • 1
  • 2

If an error is reported:

Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>  _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup  globals(),locals(),[backend_name],0)  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>  from six.moves import tkinter as Tk  File "/usr/lib/python2.7/site-packages/six.py", line 203, in load_module  mod = mod._resolve()  File "/usr/lib/python2.7/site-packages/six.py", line 115, in _resolve  return _import_module(self.mod)  File "/usr/lib/python2.7/site-packages/six.py", line 82, in _import_module  __import__(name)ImportError: No module named Tkinter
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

Tkinter is not installed. Run the following command to install tkinter:

$ sudo yum install tkinter
  • 1
  • 1

And then test again.

2.4 install scikit-learn
$ pip install -U scikit-learn
  • 1

So far, the environment is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.