编译Ptyhon的尝试
./config --prefix=/usr/local/openssl shared zlib
Can't locate IPC/Cmd.pm in @INC
https://blog.csdn.net/qq_41977843/article/details/125524691
编译python
https://www.cnblogs.com/wangss/p/12125469.html
成功编译的配置
./configure --prefix=/usr/local/python3 --enable-shared --with-openssl=/usr/local/openssl --with-ensurepip=yes CFLAGS="-I/usr/local/openssl/include"
尝试将--with-ensurepip=install添加到您的配置中:
./configure --prefix=/home/${USER}/.local_python --with-ensurepip=install
--enable-shared
启用共享,方便其他依赖python的一些内置库(比如 mysqlclient) 的资源的正常安装; 不启用可能报以下错误:
command 'gcc' failed with exit status 1
在 pyinstaller python打包时,也需要开启 --enable-shared
开启后会报 找不到so的错误 解决如下:
echo "/opt/python3.7/lib/" >> /etc/ld.so.conf
ldconfig
详细参考 https://blog.csdn.net/whatday/article/details/98052518
--enable-optimizations
--enable-optimizations 是优化选项(LTO,PGO 等)加上这个 flag 编译后,性能有 10% 左右的优化
需要加入的环境变量:
/etc/profile中:
https://blog.51cto.com/u_15668923/5348577
//---不确定有用没用
编译安装error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object fi
find / -name libpython3.8.so.1.0
cp /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib/
或者
cp /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib64/
//---------------------
已确定不需要修改Modules/Setup文件
有可能有帮助:
Linux编译安装安Python3.7/3.8出现_ssl模块错误
https://www.jb51.cc/linux/1181052.html
Linux非root安装Python3以及解决SSL问题
https://blog.51cto.com/u_15668923/5348577
Centos7.5编译安装python3.7后解决SSL不可用问题
https://blog.51cto.com/taoismli/2173359

浙公网安备 33010602011771号