Python configuration in a Linux environment, installation configuration for prerequisite libraries

Source: Internet
Author: User
Tags image processing library

1. Default Python installation status

In general, Linux is preloaded with Python, with lower versions, such as the UBUNTU15 system, which is typically preloaded with Python2.7.10.

Use the command: which Python to view the current Python installation path :

Open the corresponding path to see:

If you do not explicitly have to use the Python3 version, you can use the 2.7.10 version directly.

It is clear that you need to use the Python3 version before making changes.

It is important to note that there is a python,python2,python3 in, stating that the version 2 and 3 is installed,

2. Change the installation Python3

Http://www.cnblogs.com/zoro-robin/p/5638774.html

3, common necessary library installation and use

Common, commonly used scientific computing, data Mining machine learning and other Python third-party libraries mainly include:Numpy,Scipy, Matplotlib, Pandas, Statsmodels, Scikit-learn, Keras, Gensim, etc.

There are three common ways to install:

①, self-download source code installation, this method is flexible but need to solve the dependent library relationship.

②, using PIP for installation, it can automatically resolve dependencies.

③, using Easy_install, is similar to pip, but not as PIP.

So it is best to use Pip to install, after Windows installed Python can directly use the PIP command, under the use of Linux need to install PIP.

Use the command line directly: sudo apt-get install Python-pip installs PIP.

If an error occurs during installation, it may be the system's software source update issue, which can be updated with sudo apt-get update again.

Then use the following command line: Pip Install library name

If the installation error occurs under Linux, you can try using: ( only available in the Linux software source )

sudo apt-get install python-numpy python-scipy python-matplotlib, etc.

Use the import code in Python to test whether the relevant library can be imported and used properly.

4. IDE Use

①, Spyder

is a powerful interactive Python language development environment that provides advanced code editing, interactive testing, debugging and other features that support Windows, Linux, and OS X systems

You can use the sudo apt-get install Spyder to complete the download installation and see it in the system's software list after installation.

②, other

5. Common Library Records

0, Numpy

Open-source numerical computing extensions, which can be used to store and manipulate large matrices, are much more efficient than Python's own nested list (nested list structure) structure.

Many libraries are based on this library, so it's especially important. The most common is its array function, Numpy.array ([,,,,,])

Test Example:

1 Import NumPy as NP 2 3 a = Np.array ([2,0,1,5])4print(a)

①, Scikit-image

Image processing library, dependent library:numpy+mkl( currently unknown so , do not know the difference with NumPy, using PIP installation scikit-image a bunch of warning, but the final hint is that the installation was successful. )

Here are some instructions, refer to: http://blog.csdn.net/spirit_go/article/details/51567363

Test Example:

1  from Import data, Io, filters 2 3 image = Data.coins ()              #  or any NumPy array! 4 edges = Filters.sobel (image)5io.imshow (edges)6 io.show ()

②, Scipy

Matrix data Processing library, which includes statistics, optimization, integration, linear algebra module, Fourier transform, signal and image processing, ordinary differential equation solver and so on, the dependent library is numpy, but some people say scipy relies on numpy+mkl, need to install this corresponding library can be.

Test Example:

1  fromScipy.optimizeImportFsolve2 3 deff (x):4X1 =X[0]5x2 = x[1]6     return[2*x1-x2**2-1, X1**2-x2-2]7     8result = Fsolve (f,[1,1])9 Ten Print(Result)#output as [1.91963957 1.68501606]

③,

Python configuration in a Linux environment, installation configuration for prerequisite libraries

Related Article

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.