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