PY First ask python3.5.2 Linux installation __linux

Source: Internet
Author: User

1.https://www.python.org/downloads/release/python-352/

Download

2. Login to Linux system

-->useradd Python3

-->PASSWD xxxxxxxx

3. Give root permission

Modify the/etc/sudoers file, locate the following line, and add a row under Root, as follows:
# # Allow ROOT to run any commands anywhere
Root all= (All)
Python3 all= (All)
After the modification is complete, you can now log in with the Python3 account and then use the command Su-to get the root permission to operate.

4. Modify File/directory-owned user/user group

Modify User

Chown Python3/home/python3

Modify user Groups

Chgrp Python3/home/python3

5. The path is not shown in the Linux shell, and it is inconvenient to display it as-bash-4.1#.

How to show the path to the shell instead?

The steps are as follows:

Vim ~/.bash_profile

(Don't worry about it. Bash_profile This file has several, it is also possible to create a new one)

At the end add
Export ps1= ' [\u@\h \w]\$ '

And then execute
SOURCE ~/.bash_profile

So the shell can show the path.

6.ftp upload installation files to server

Here to choose the first download can be downloaded is the source code package: python-3.5.1.tgz, download a good upload to the server, began to install

To release a file:

Tar-xvzf python-3.5.1.tgz

Enter directory:

CD PYTHON-3.5.1/

To add a configuration:

./configure--prefix=/usr/python

Here, configure your own installation directory, then compile the source code:

Make

To perform the installation:

Make install

The entire process is approximately 5-10 minutes, after the installation is successful, the installation directory is/usr/python

The original python in the system in/usr/bin/python, through Ls-l can see that Python is a soft link, linked to the python2.6 in this directory

We can either delete this or create a new Python3 soft link, except that Python will be changed to Python3 when it is executed, or the Python script Head declaration should be changed to #!/usr/bin/python3

Here for the convenience of the proposal to rename first, and then create a soft link, the previous program head does not have to change:

$ mv/usr/bin/python/usr/bin/python.bak
$ ln-s/usr/python/bin/python3/usr/bin/python
$ ln-s/usr/python/bin/pip3.5/usr/bin/pip
Remove Soft connections
Rm-rf/usr/bin/pip

This is established, and then directly execute the python command, which is equivalent to call Python3, actually Python3 is also a soft link, link to python3.5.1, this multiple links in fact does not affect, mainly for version upgrades more convenient, do not change the version number

Python3 new version of the installation is these, do not uninstall the old version, the new version of the same normal use of Python



The preceding Python command specifies a soft connection that can be executed directly through the Python command,


But the system has a 2.7 version, which causes the PIP installation problem


You can use the/usr/bin/python-m pip Install Pillow for package installation, using the


Root User Installation



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.