Compiling the installation from source code
- Download the latest version from the Python website
- Unzip
tar -xzvf Python-3.6.4.tgz
, modify the package name according to the version number
cd Python-2.7.9/
LDFLAGS="-L/usr/lib/x86_64-linux-gnu" ./configure
make
sudo make install
Error
zipimport.ZipImportError: can‘t decompress data; zlib not availableMakefile:1099: recipe for target ‘install‘ failedmake: *** [install] Error 1
Reason:
Related Toolkit for missing zlib
Solve:
- Install zlib dependent packages:
yum -y install zlib*
orsudo apt-get install zlibc zlib1g-dev
- To the Python installation directory to execute the
sudo ./configure
- To enter the Python installation package, modify the setup file for the module path:
vim module/setup
Find a line of code:
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
Remove Comments:
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
After installing the above dependency package, re-enter the terminal and proceed to Python's installation package path:
make && make install
Recompile the installation
If you encounter permissions problems, precede the command by addingsudo
Install Paint Packages
apt-get install python-pippip install numpypip install matplotlib
Install Python in Ubuntu