Linux installation Python3.5__linux

Source: Internet
Author: User
Tags delete key install openssl openssl readline sqlite python script

1. Go to the Python website to download the Python3 source package, https://www.python.org/downloads/release/python-354/

Select gzipped Source tarball Download the python-3.5.4.tgz file.

2. Create the Python installation directory in/usr

mkdir python
Upload the python-3.5.4.tgz file to Python.
If you do not upload the download command, use the Yum installation
Yum Install Lrzsz-y
Extract Files
Tar-xvzf python-3.5.1.tgz
Get Python-3.5.4 directory, enter
CD Python-3.5.4
Perform
./configure--prefix=/usr/python
found that the error, should be missing some of the dependencies, Python installation before the need for some necessary modules, such as Openssl,readline, if there is no such modules later use will appear some problems, such as no OpenSSL does not support SSL-related functions, and PIP3 in the installation of the module will be a direct error; no readline the Python interactive interface delete key and arrow keys are not normal use, as to what the module needs after make Python will give a hint, through the prompts to install can be installed.
Yum-y Install GCC
Yum-y Install zlib Zlib-devel
Yum-y Install bzip2 Bzip2-devel
Yum-y Install ncurses Ncurses-devel
Yum-y Install ReadLine Readline-devel
Yum-y Install OpenSSL Openssl-devel
Yum-y Install Openssl-static
Yum-y Install XZ Lzma xz-devel
Yum-y Install SQLite sqlite-devel
Yum-y Install gdbm Gdbm-devel
Yum-y Install TK tk-devel
Install these dependency packs and execute again
./configure--prefix=/usr/python
Re-compiling the source code
Make
Performing the installation
Make install
The installation is complete.
But when you enter Python you will find the old version of Python, because the original Python in the system is/usr/bin/python, and through ls-l you can see that Python is a soft link that links to the python2.7 in this directory
You can not delete this, not the original default environment to make any changes, only a new Python3 soft link, just need to execute Python3 code when python to change to Python3, or Python script head interpreter to #!/usr/bin/ Python3
This/usr/bin is built in soft links as follows:
Ln-s/usr/python/bin/python3/usr/bin/python3
Using Python3 input
Python3
Go to the python command.

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.