ubuntu16 compile and install python3

1.安装编译环境
sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev

2. Download the Python-3.7.2.tgz

3. Extract
tar -xvzf Python-3.7.2.tgz

4. into the directory
cd Python-3.7.2 /

5. Compile configuration
./configure --prefix = / usr / bin / python3.7

6. Compile and install
sudo make && sudo make install

6. Set python3.7.2 soft link
sudo RM / usr / bin / python3
sudo -s /usr/bin/python3.7/bin/python3.7 LN / usr / bin / python3

7. Test
Now enter the system is not python3 call comes python3.5, but rather just installed python3.7

8. The flexible connection provided PIP3
RM -rf / usr / bin / PIP3
the sudo -s /usr/bin/python3.7/bin/pip3 LN / usr / bin / PIP3

[Pip3 given problems and solutions]
subprocess.CalledProcessError: Command '(' lsb_release ' ,' -a ')' returned non-zero exit status 1.
Solution
Find / -name lsb_release
RM -rf / usr / bin / lsb_release

 

Guess you like

Origin www.cnblogs.com/nan424164292/p/11617369.html