一,参考文档:
https://devguide.python.org/getting-started/setup-building/#install-dependencies
主要是补充python所需依赖的开发库,如果这些库未安装,
则在安装python的过程中就会报出下面所列的错误,
安装依赖库的命令:ubuntu如下:
sudo apt-get install build-essential gdb lcov pkg-config \
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
lzma lzma-dev tk-dev uuid-dev zlib1g-dev
二,pkg-config
报错:
configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.
解决:
root@lhdpc:/usr/local/source/Python-3.12.0# apt-get install pkg-config
三,gcc
1,报错信息:
configure: error: no acceptable C compiler found in $PATH
如下:
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no
configure: error: in `/usr/local/source/Python-3.12.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
2,解决:安装gcc套件即可
root@lhdpc:/usr/local/source/Python-3.12.0# apt-get install gcc
说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/11/11/ubuntu-python-bian-yi-an-zhuang-guo-cheng-zhong-de-bao-cuo-python-3-12-ubuntu-23-10/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]
三,make
1,报错信息
root@lhdpc:/usr/local/source/Python-3.12.0# make
Command 'make' not found, but can be installed with:
apt install make # version 4.3-4.1build1, or
apt install make-guile # version 4.3-4.1build1
2,解决:
按提示执行apt install make即可
root@lhdpc:/usr/local/source/Python-3.12.0# apt install make
四,zlib
报错:
Traceback (most recent call last):
File "<frozen zipimport>", line 518, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
解决:
root@lhdpc:/usr/local/source/Python-3.12.0# apt-get install zlib1g-dev
五,openssl
报错:
Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer
解决:
root@lhdpc:/usr/local/source/Python-3.12.0# apt-get install libssl-dev
标签:python,3.12,apt,Python,报错,dev,install,ubuntu
From: https://www.cnblogs.com/architectforest/p/17830801.html