wget https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tgz
tar -zxvf Python-3.11.5.tgz
cd Python-3.11.5
执行配置帮助
./configure --help
主要是想设置安装路径
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
安装到当前用户的路径下再配置环境变量即可,不脏了系统级/usr
的环境
mkdir -p $HOME/usr/Python-3.11.5
$ ./configure --prefix=$HOME/usr/Python-3.11.5
make -j16
执行configure或者make都可能会出现各种依赖缺失的问题,dnf安装或者找到依赖的源代码编译安装即可
我执行make得到的信息如下:
The necessary bits to build these optional modules were not found:
_dbm _gdbm _hashlib
_ssl _tkinter _uuid
nis readline
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py have not
been built, they are *disabled* by configure:
_sqlite3
Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer
缺少openssl,dnf安装sudo dnf install openssl openssl-devel
再次make
然后添加$HOME/usr/Python-3.11.5
到PATH
即可
- 源代码 python3 centos stream python源代码python3 centos stream centos7 python3 centos python python3 centos python python3 centos python numpy mysqlclient python3 centos python python3教程centos python centos6 python3 django1 centos python3 centos python module openssl1 python3 openssl centos python3 tkinter方法centos