Installing Python 3 under CentOS 6

Source: Internet
Author: User

Can download each version of the python:https://www.python.org/ftp/python/configuration installation

Download the latest installation package (as of 2013/11/05) or version 3.3.2.

#wget http://python.org/ftp/python/3.5.2//Python-3.5.2.tgz#tar xzf Python-3.5.2.tgz#cd Python-3.5.2#./configure --prefix=/opt/apps/python3#make#make install

If prefix is not specified, it is installed by default under/usr/local, so it can be found in path. We want to install a version that can be copied and installed, so it is installed in the specified directory.

Setting up the environment

/opt/apps/python3/bin can be added to the system environment variable,

#echo ‘export PATH=$PATH:/opt/apps/python3/bin‘ >> ~/.bash_profile

And we are easy to set up soft links more convenient

#ln -s /opt/apps/python3/bin/python3 /usr/bin

Confirm Installation Success

# python3 -VPython 3.5.2
Install PIP

PIP is convenient for installing dependent software, so it is recommended to install.

#wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - |python3#wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O - |python3#ln -s /opt/apps/python3.5/bin/pip-3.5 /usr/bin/
Install required third-party libraries

such as Mysql-connector and requests

#pip-3.5 install mysql-connector-python#pip-3.5 install requests

If the following error occurs when you install PIP:

ImportError: No module named bz2

This indicates that the installed Python 3 is missing a dependent library bzip2-devel and needs to install the dependent libraries before compiling the installation.

To view the compiled parameters for the installed Python, refer to: StackOverflow

Original address: CentOS 6 installs Python 3, thanks to the original author to share.

Installing Python 3 under CentOS 6

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.