安装zlib模块
#下载地址http://www.zlib.net/
tar xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
#zlib 安装完后,libz.a 在 /usr/local/lib/,zlib.h 文件在 /usr/include
#(opensuse 中 zlib.h 默认放在 /usr/local/include/中)
编译安装
tar -xzvf Python-3.6.4.tgz
cd Python-3.6.4
#./configure --prefix=/usr/local/Python-3.6.4
./configure --prefix=/usr/local/Python-3.6.4 --with-zlib=/usr/include
make clean
make
make install
今天发现还有一些常用模块不能用,编译发现如下提示:下面的模块都缺少相关的依赖包而安装不了!
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _tkinter readline
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
安装zypper se bz2的模块
#下载地址http://www.bzip.org/downloads.html
tar -xzvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
#为编译做准备,创建 libbz2.so 动态链接库 (这一步很重要,安装 python 的时候如果没有这一步,python 安装不上 bz2 模块)
make -f Makefile-libbz2_so
make && make install
安装zypper se sqlite3的模块
#下载地址http://www.sqlite.org/2014/sqlite-autoconf-3080600.tar.gz
./configure --prefix=/usr/local
make && make install
安装模块zypper se readline
#下载 readline https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
./configure
make && make install
安装模块 zypper se ssl
#下载 https://www.openssl.org/source/openssl-1.0.2n.tar.gz
./config
make && make install
安装模块 zypper se tkinter [失败]
#下载 tkinter https://iweb.dl.sourceforge.net/project/tcl/Tcl/8.6.8/tk8.6.8-src.tar.gz
#下载 tkinter https://prdownloads.sourceforge.net/tcl/tcl8.6.8-src.tar.gz
#下载 tkinter http://ftp.gwdg.de/pub/opensuse/distribution/leap/42.3/repo/oss/suse/x86_64/python3-tk-3.4.6-11.1.x86_64.rpm
rpm -q tcl && rpm -q tk
cd /root/install/tcl8.6.8/unix
./configure
make && make install
#安装zypper se lzma的模块
#LZMA comes as part of the XZ open source compression library.
#https://tukaani.org/xz/xz-5.2.3.tar.gz
#find /usr /opt -name "lzma.h" -print
./configure
make && make install
rpm -ivh python3-tk-3.4.6-11.1.x86_64.rpm --nodeps
使用上面的方案安装模块之后,还有这个_tkinter一直找不到安装的方法,同时还有_hashlib _ssl二个模块安装失败。
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_hashlib _ssl
先到这里了,发现Python的环境大都是contos,找SUSE的资料都找不多到,少得可怜。