python3 编译示例:

./configure --prefix=/usr/local --enable-shared  --enable-optimizations

 

 --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% 左右的优化

Logo

更多推荐