Install Python 3.3.4 in CentOS 6.4

Source: Internet
Author: User

1. Download python

Official Website http://www.python.org/download python-3.3.4.tgz

Whether the browser is saved as a download or shell command download, download it to a local directory, decompress it, compile and install it, and configure the environment variable OK. The local download directory is "~ /Download this directory.

Note: The shell command is downloaded as # wget http://www.python.org/ftp/python/3.3.4/Python-3.3.4.tgz

CentOS 6.4 will be automatically downloaded.

2. Unzip the Python-3.3.4.tgz

Decompress command: # tar-xzvf Python-3.3.4.tgz

Note: because it is a file with the. tgz suffix, the parameter is-xzvf. If it is a compressed file in another format, the parameters will be different.

If you do not specify to decompress the package to a directory, the package is decompressed to the directory of the same level by default.

3. Compile and install Python-3.3.4

Enter the decompressed directory, # cd ~ /Download/python-3.3.4

Install python in the directory you set later, #./configure -- prefix =/usr/local/python-3.3

Note:/usr/local/python-3.3 is the self-created directory.

Compile command # make

... Compilation in progress... waiting

Installation command # make install

4. Configure the environment

Because cenost 6.4 comes with python2.6 after installation, you can directly enter the command # python version 2.6.

Unless you enter the absolute path to access the newly installed version #/usr/local/python-3.3/bin/python3.3. Of course, it is too troublesome to enter the absolute path every time. Then, modify the environment variable.

The procedure is as follows:

First check the current PATH variable # eohc $ {PATH}

...

Add the PATH to the PATH variable # PATH = "$ PAHT":/usr/local/python-3.3/bin

Note:/usr/local/python-3.3/bin is the directory where python was just installed.

...

Finally, check whether the current PATH variable # eohc $ {PATH} is added.

...

After configuring the PATH, you have to do one more thing, in the/usr/bin/directory, we recommend that you point a link file to the file/usr/local/python-3.3/bin/python3.3, in this way, you only need to enter # python to automatically start version 3.3.4.

First, go to the # cd/usr/bin/directory.

Then enter the command # rm-rf python to delete the old 2.6 link file, and then create a new one. The following command:

# Ln-s/usr/local/Python-3.3/bin/python3.3./python

In this way, we will see such a file in the/usr/bin/directory:

Lrwxrwxrwx. 1 root 23 March 3 10:33 python->/usr/local/python3.3/bin/python3.3

Here, python is basically installed.

Python details: click here
Python: click here

Recommended reading:

Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]

Obtain Linux information using a Python script

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.