Conversion of Python 2.7 to Python 3.X under Ubuntu

Source: Internet
Author: User

Conversion of Python 2.7 to Python 3.X under Ubuntu

Since Ubuntu itself comes with Python 2.7, and Python 3.X is a lot different from 2.7, there are many inconveniences when using Python 3.X. So here's the record under Ubuntu

Python 2.7 Conversion with Python 3.X method:

Download Python3 First

sudo add-apt-repository ppa:fkrull/deadsnakes# Add a source sudo apt-get  update# update the source list to get the latest version of sudo apt -Get install python3# using apt-get for installation

However, the default Python version is still python 2.7

Change to Python 3.x:

The first method:

Using alias aliases, add the following statement to ~/.bashrc or~/.bash_aliases

Alias Python=python3

The second method:
sudo rm/usr/local/bin/-s/usr/bin/python3. 4 /usr/local/bin/python

The default path for Python after running the above two commands is Python 3.4.3.

So how do you change it back? Similarly:

sudo rm/usr/local/bin/-s/usr/bin/python2. 7 /usr/local/bin/python

If you encounter other problems, need to repair, re-download it:

sudo apt-get install--reinstall python-minimalsudo apt-get install--reinstall python2. 7

Conversion of Python 2.7 to Python 3.X under Ubuntu

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.