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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容