如何修复编译时的错误 Python 3.2.0
How to fix the errors while compiling Python 3.2.0
我正在尝试创建 Python-3.2.0 虚拟环境来升级我的工具。
该工具早先使用 2.7.15 版本构建。现在我想升级到Python-3.2.0
这些是我在 Cent-OS 上遵循的步骤:
(a) 从官方仓库下载 Python 源代码
光盘/tmp
wget https://www.python.org/ftp/python/3.2/Python-3.2.tgz
tar-xvfPython-3.2
cd Python-3.2
(b) 使用所需标志编译 Python
./configure --enable-optimizations --enable-shared --
prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib
须藤安装
我遇到以下错误:
/usr/bin/install -c python-config /opt/python/bin/python3.2m-config
rm python-config
LD_LIBRARY_PATH=/tmp/Python-3.2: ./python -E ./setup.py install \
--prefix=/opt/python \
--install-scripts=/opt/python/bin \
--install-platlib=/opt/python/lib/python3.2/lib-dynload \
--root=/
running install
running build
running build_ext
building dbm using ndbm
INFO: Can't locate Tcl/Tk libs and/or headers
building '_dbm' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_NDBM_H -IInclude -I/opt/python/include -I. -I./Include -I/usr/local/include -I/tmp/Python-3.2 -c /tmp/Python-3.2/Modules/_dbmmodule.c -o build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o
I n file included from Include/Python.h:111:0,
from /tmp/Python-3.2/Modules/_dbmmodule.c:6:
Include/modsupport.h:27:1: warning: ‘_PyArg_ParseTuple_SizeT’ is an unrecognized format function type [-Wformat=]
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
^
gcc -pthread -shared -Wl,-rpath=/opt/python/lib build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o -L. -L/opt/python/lib -L/usr/local/lib -lpython3.2m -o build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so
*** WARNING: renaming "_dbm" since importing it failed: build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so: undefined symbol: dbm_nextkey
Python build finished, but the necessary bits to build these modules were not found:
_tkinter bz2 ossaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_dbm
running build_scripts
copying and adjusting /tmp/Python-3.2/Tools/scripts/pydoc3 -> build/scripts-3.2
copying and adjusting /tmp/Python-3.2/Tools/scripts/idle3 -> build/scripts-3.2
copying and adjusting /tmp/Python-3.2/Tools/scripts/2to3 -> build/scripts-3.2
changing mode of build/scripts-3.2/pydoc3 from 644 to 755
首先我想说的是,您尝试做的事情是徒劳的。检查:
所以:
您正在尝试 "upgrade" 从年底将不再支持的版本(您的特定风格 (v2.7.15) 去年发布) 到一个已经死了好几年的版本
更多:您正在尝试 v3.2.0 这是 1st那个系列之一
快速搜索您发现的错误:
- [Python.Bugs]: _dbm not building on Fedora 17
- [Python.Bugs]: Failure to build _dbm with ndbm on Arch Linux
现在,这可能是也可能不是您的情况的原因。如果是,则有一个修复程序,但您 不会从中受益,因为 #2..
几个想法:
- 一般来说,软件系列的第 1st 版本可能有更多错误,因为它没有经过太多测试"in the real world"(因为它还没有尚未发布)。如果在它之上构建了其他软件(在这种情况下,其他 Python 3rd-派对模块)。作为示例(尽管与当前场景无关),您可以检查
- 您应该使用受支持和维护的 (Python) 版本(例如 v3.8, 或 v3.7), 这样如果 运行 你就有机会获得帮助进入问题
- 如果出于某些原因(我觉得不合逻辑)你需要坚持使用 v3.2,至少尝试使用最新的([Python]: Python-3.2.6.tgz )
我正在尝试创建 Python-3.2.0 虚拟环境来升级我的工具。 该工具早先使用 2.7.15 版本构建。现在我想升级到Python-3.2.0
这些是我在 Cent-OS 上遵循的步骤:
(a) 从官方仓库下载 Python 源代码 光盘/tmp wget https://www.python.org/ftp/python/3.2/Python-3.2.tgz tar-xvfPython-3.2 cd Python-3.2
(b) 使用所需标志编译 Python ./configure --enable-optimizations --enable-shared -- prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib 须藤安装
我遇到以下错误:
/usr/bin/install -c python-config /opt/python/bin/python3.2m-config
rm python-config
LD_LIBRARY_PATH=/tmp/Python-3.2: ./python -E ./setup.py install \
--prefix=/opt/python \
--install-scripts=/opt/python/bin \
--install-platlib=/opt/python/lib/python3.2/lib-dynload \
--root=/
running install
running build
running build_ext
building dbm using ndbm
INFO: Can't locate Tcl/Tk libs and/or headers
building '_dbm' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_NDBM_H -IInclude -I/opt/python/include -I. -I./Include -I/usr/local/include -I/tmp/Python-3.2 -c /tmp/Python-3.2/Modules/_dbmmodule.c -o build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o
I n file included from Include/Python.h:111:0,
from /tmp/Python-3.2/Modules/_dbmmodule.c:6:
Include/modsupport.h:27:1: warning: ‘_PyArg_ParseTuple_SizeT’ is an unrecognized format function type [-Wformat=]
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
^
gcc -pthread -shared -Wl,-rpath=/opt/python/lib build/temp.linux-x86_64-3.2/tmp/Python-3.2/Modules/_dbmmodule.o -L. -L/opt/python/lib -L/usr/local/lib -lpython3.2m -o build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so
*** WARNING: renaming "_dbm" since importing it failed: build/lib.linux-x86_64-3.2/_dbm.cpython-32m.so: undefined symbol: dbm_nextkey
Python build finished, but the necessary bits to build these modules were not found:
_tkinter bz2 ossaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_dbm
running build_scripts
copying and adjusting /tmp/Python-3.2/Tools/scripts/pydoc3 -> build/scripts-3.2
copying and adjusting /tmp/Python-3.2/Tools/scripts/idle3 -> build/scripts-3.2
copying and adjusting /tmp/Python-3.2/Tools/scripts/2to3 -> build/scripts-3.2
changing mode of build/scripts-3.2/pydoc3 from 644 to 755
首先我想说的是,您尝试做的事情是徒劳的。检查:
所以:
您正在尝试 "upgrade" 从年底将不再支持的版本(您的特定风格 (v2.7.15) 去年发布) 到一个已经死了好几年的版本
更多:您正在尝试 v3.2.0 这是 1st那个系列之一
快速搜索您发现的错误:
- [Python.Bugs]: _dbm not building on Fedora 17
- [Python.Bugs]: Failure to build _dbm with ndbm on Arch Linux
现在,这可能是也可能不是您的情况的原因。如果是,则有一个修复程序,但您 不会从中受益,因为 #2..
几个想法:
- 一般来说,软件系列的第 1st 版本可能有更多错误,因为它没有经过太多测试"in the real world"(因为它还没有尚未发布)。如果在它之上构建了其他软件(在这种情况下,其他 Python 3rd-派对模块)。作为示例(尽管与当前场景无关),您可以检查
- 您应该使用受支持和维护的 (Python) 版本(例如 v3.8, 或 v3.7), 这样如果 运行 你就有机会获得帮助进入问题
- 如果出于某些原因(我觉得不合逻辑)你需要坚持使用 v3.2,至少尝试使用最新的([Python]: Python-3.2.6.tgz )