Linux 上安装 python

Step to install python on Linux system

  1. 下载python源码包并解压缩
$ wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
tar xf Python-3.*
  1. 进入到文件夹 build源码

cd Python-3.*
#Prepare compilation 
./configure
#Build
make
  1. 将python安装到系统
#Install
make install

OR if you don't want to overwrite the python executable (safer, at least on some distros yum needs python to be 2.x, such as for RHEL6) - you can install python3.* as a concurrent instance to the system default with an altinstall:

make altinstall

安装中会出现的问题以及解决方法
zipimport.ZipImportError: can't decompress data; zlib not available
使用yum安装依赖zlib、zlib-devel

你可能感兴趣的:(Linux 上安装 python)