Download the installation package python3.6.5
1. Upload the installation package. Open a terminal, use the command cd into the folder where the file
python@ubuntu:~/workspace$pwd
/home/python/workspace
2. Unzip the file
tar xfzPython-3.6.5.tgz
Note: As used herein xfz command instead recommended -xvzf command because its release folder requires root privileges before you can change or delete.
python@ubuntu:~/workspace$tar xfz Python-3.6.5.tgz
python@ubuntu:~/workspace$ll
The total amount of 22 472
drwxrwxr-x 4 python python 4096 5 月 12 19:06 ./
drwxr-xr-x 30python python 4096 12 月 26 22:56 ../
drwxrwxr-x 2 python python 4096 12 月 26 22: 56python /
drwxr-xr-x 16python python 4096 3 月 28 18: 24Python-3.6.5 /
-rwxrw-rw- 1 python python 22994617 5 月 12 18: 40Python-3.6.5.tgz *
python@ubuntu:~/workspace$
3. extract the files into the folder, add the configuration
cd Python-3.6.5 /
./configure "--prefix=/usr/bin/python3.6"
4. To install Python configuration file is desired folder. After the configuration, the terminal will display the following paragraph, you can choose to ignore it, does not affect the subsequent operation.
If you want arelease build with all optimizations active (LTO, PGO, etc),
please run./configure –enable-optimizations
5. Compile Source
sudo make
Compilation process takes a few minutes, it may be error, see the specific version of gcc you have installed.
6. perform the installation
sudo make install
The installation process for a few minutes, the installation is successful, the installation of Python in a folder in the computer /usr/bin/python3.6.
python@ubuntu:/usr/bin$cd python3.6/
python@ubuntu:/usr/bin/python3.6$ls
bin include lib share
python@ubuntu:/usr/bin/python3.6$pwd
/usr/bin/python3.6
7. Modify the default version of Python
Ubuntu16.04 version integrates Python2.7 and 3.5 versions of the original system python in / usr / bin / python, can be seen by ls -l, python is a soft link to the python2.7 in this catalog
We need to first delete the default link, then create a soft link of python3.6 .. First make sure the pointer terminal has returned to the root directory, and then perform the following operations.
8. The need to remove the original Python link files: rm / usr / bin / python
Note that if the terminal prompt: rm: can not delete '/ usr / bin / python': authority is not enough, then you need to use sudo or root privileges to open the link deleted.
9. points Python3.6 establish a link, not enough words to use root privileges or sudo add command:
ln -s /usr/bin/python3.6/bin/python3.6 /usr/bin/python
The Python version of
Python @ Ubuntu: ~ $ -V Python
Python 3.6.5
If the display is python3.6.5 the installation is successful!