【发布时间】:2017-04-11 09:34:07
【问题描述】:
如何在 alpine docker 容器中安装 python2.6。
我尝试从源代码安装,它给了我编译错误。
其实我想在容器中安装 Python2.6 和 Python2.7。这样我就可以在 Python2.6 和 Python2.7 上运行单元测试。请对此提出一些想法。
我已经在 alpine 容器中安装了 gcc 、 g++ 、 make 然后做了以下步骤。
wget https://www.python.org/ftp/python/2.6/Python-2.6.tgz
tar xvzf Python-2.6.tgz
cd Python-2.6
./configure
make
make 时遇到这个错误,
~/Python-2.6 # make
gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/config.o Modules/config.c
gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -DPYTHONPATH='":plat-linux4:lib-tk:lib-old"' \
-DPREFIX='"/usr/local"' \
-DEXEC_PREFIX='"/usr/local"' \
-DVERSION='"2.6"' \
-DVPATH='""' \
-o Modules/getpath.o ./Modules/getpath.c
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:6173:1: error: conflicting types for 'posix_close'
posix_close(PyObject *self, PyObject *args)
^
In file included from Include/Python.h:44:0,
from ./Modules/posixmodule.c:30:
/usr/include/unistd.h:38:5: note: previous declaration of 'posix_close' was here
int posix_close(int, int);
^
Makefile:1234: recipe for target 'Modules/posixmodule.o' failed
make: *** [Modules/posixmodule.o] Error 1
谁能建议我如何解决这个问题?
【问题讨论】:
-
不确定它是否会有所帮助,但也许值得花点时间看看 Alpine 过去如何构建 2.6:git.alpinelinux.org/cgit/aports/tree/main/… 以及他们如何构建 2.7:git.alpinelinux.org/cgit/aports/tree/main/python2。