Home > OS >  The Linux source code to install python
The Linux source code to install python

Time:09-18

1. Download python3 source package
Wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz


2. Unzip the source code package
The tar ZXVF Python - 3.6.6. TGZ

3. Enter the source code package folder
CD Python - 3.6.6

4. Compile and install?
./configure -- prefix=/opt/python36 # the specified installation directory is/opt/python36, is critical, because it is easy to uninstall

5. Compile
# make the inside of the equivalent of the source code package code compiled into Linux server can identify the code

Step 6. Compiler installed, this will eventually generate/opt/python36/
Make install
Note: steps 4 and 5 can be executed concurrently, but need to use in the middle & amp; & Separated by
Make & amp; & Make install # to make first, after the completion of execution to perform make install
Into the/opt directory view python36 folders, we want the python3 here

/opt/python36/bin/python3
/opt/python36/bin/pip3
.

7. Change the path variable, Linux add python3
Modify/etc/profile system environment variable configuration file, add the following content
Vim/etc/profile
# ~/. Following this is the user environment variable configuration file
Environment variable configuration file/etc/profile # system
PATH=/opt/python36/bin:/usr/local/sbin,/usr/local/bin:/usr/sbin,/usr/bin:/root/bin
? Note: be sure to put python3 directory first

8. In order to effect a permanent path Settings, added to the/etc/profile global environment variable configuration file? Reload the configuration file/etc/profile,
This installation is successful,

9. But when performing pip3 install,,,,, appear the following error:
PIP is configured with locations that require the TLS/SSL, clear the SSL module Python is not available in the
, SSL has been installed, however,

In step 4, 10. Should do so, execute./configure -- prefix=/opt/python36, plus - with - SSL, as follows:
prefix=/opt/python36 - with - SSL


  • Related