我正在尝试从启用了fpectl
模块的Docker容器内的源代码安装Python 2.7.14。
使用official Python jessie Dockerfile作为起点,我已将--with-fpectl
配置选项添加到./configure
命令。
您可以看到我的docker build命令in this gist的完整输出;然而,这里有一些有趣的内容:
./configure --build=x86_64-linux-gnu --enable-shared --enable-unicode=ucs4 --with-fpectl
...
checking for --with-fpectl... yes
...
x86_64-linux-gnu-gcc -pthread -fPIC -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/src/python/Include -I/usr/src/python -c /usr/src/python/Modules/mathmodule.c -o build/temp.linux-x86_64-2.7/usr/src/python/Modules/mathmodule.o
In file included from Include/Python.h:156:0,
from /usr/src/python/Modules/mathmodule.c:55:
/usr/src/python/Modules/mathmodule.c: In function ‘math_fsum’:
Include/pyfpe.h:164:64: warning: passing argument 1 of ‘PyFPE_dummy’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v));
^
/usr/src/python/Modules/mathmodule.c:1072:5: note: in expansion of macro ‘PyFPE_END_PROTECT’
PyFPE_END_PROTECT(hi)
^
Include/pyfpe.h:134:15: note: expected ‘void *’ but argument is of type ‘volatile double *’
extern double PyFPE_dummy(void *);
^
...
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
(我实际上认为来自mathmodule.c
的错误消息是良性的,但我认为我会将其包含在上下文中,因为它是唯一似乎与{{1}相关的其他输出}模块。)
当我使用此版本创建的图像启动容器时,我安装了Python,但没有fpectl
模块:
fpectl
我知道不鼓励使用docker run -it <IMAGE ID> /bin/bash
root@54895ad345bb:/# python
Python 2.7.14 (default, Nov 16 2017, 02:12:20)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpectl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named fpectl
>>> import sysconfig
>>> print(sysconfig.get_config_var('CONFIG_ARGS'))
'--build=x86_64-linux-gnu' '--enable-shared' '--enable-unicode=ucs4' '--with-fpectl' 'build_alias=x86_64-linux-gnu'
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer ast imghdr sha
Bastion asynchat imp shelve
CDROM asyncore importlib shlex
CGIHTTPServer atexit imputil shutil
Canvas audiodev inspect signal
ConfigParser audioop io site
Cookie base64 itertools smtpd
DLFCN bdb json smtplib
Dialog binascii keyword sndhdr
DocXMLRPCServer binhex lib2to3 socket
FileDialog bisect linecache spwd
FixTk bsddb linuxaudiodev sqlite3
HTMLParser bz2 locale sre
IN cPickle logging sre_compile
MimeWriter cProfile macpath sre_constants
Queue cStringIO macurl2path sre_parse
ScrolledText calendar mailbox ssl
SimpleDialog cgi mailcap stat
SimpleHTTPServer cgitb markupbase statvfs
SimpleXMLRPCServer chunk marshal string
SocketServer cmath math stringold
StringIO cmd md5 stringprep
TYPES code mhlib strop
Tix codecs mimetools struct
Tkconstants codeop mimetypes subprocess
Tkdnd collections mimify sunau
Tkinter colorsys mmap sunaudio
UserDict commands modulefinder symbol
UserList compileall multifile symtable
UserString compiler multiprocessing sys
_LWPCookieJar contextlib mutex sysconfig
_MozillaCookieJar cookielib netrc syslog
__builtin__ copy new tabnanny
__future__ copy_reg nis tarfile
_abcoll crypt nntplib telnetlib
_ast csv ntpath tempfile
_bisect ctypes nturl2path termios
_bsddb curses numbers textwrap
_codecs datetime opcode this
_codecs_cn dbhash operator thread
_codecs_hk dbm optparse threading
_codecs_iso2022 decimal os time
_codecs_jp difflib os2emxpath timeit
_codecs_kr dircache ossaudiodev tkColorChooser
_codecs_tw dis parser tkCommonDialog
_collections distutils pdb tkFileDialog
_csv doctest pickle tkFont
_ctypes dumbdbm pickletools tkMessageBox
_ctypes_test dummy_thread pip tkSimpleDialog
_curses dummy_threading pipes toaiff
_curses_panel easy_install pkg_resources token
_elementtree email pkgutil tokenize
_functools encodings platform trace
_hashlib ensurepip plistlib traceback
_heapq errno popen2 ttk
_hotshot exceptions poplib tty
_io fcntl posix turtle
_json filecmp posixfile types
_locale fileinput posixpath unicodedata
_lsprof fnmatch pprint unittest
_multibytecodec formatter profile urllib
_multiprocessing fpformat pstats urllib2
_osx_support fractions pty urlparse
_pyio ftplib pwd user
_random functools py_compile uu
_socket future_builtins pyclbr uuid
_sqlite3 gc pydoc virtualenv
_sre gdbm pydoc_data virtualenv_suppor
_ssl genericpath pyexpat warnings
_strptime getopt quopri wave
_struct getpass random weakref
_symtable gettext re webbrowser
_sysconfigdata glob readline wheel
_testcapi grp repr whichdb
_threading_local gzip resource wsgiref
_tkinter hashlib rexec xdrlib
_warnings heapq rfc822 xml
_weakref hmac rlcompleter xmllib
_weakrefset hotshot robotparser xmlrpclib
abc htmlentitydefs runpy xxsubtype
aifc htmllib sched zipfile
antigravity httplib select zipimport
anydbm idlelib sets zlib
argparse ihooks setuptools
array imaplib sgmllib
模块,并且它与官方Python Docker图像捆绑在一起的Python版本中不存在;但是,这是我的用例的要求(具体来说,使用fpectl
针对Python安装编译的Cython模块的可操作性,更多信息here和here)。
通过aptly 提供的--with-fpectl
包似乎包含python
模块(见下文)。但是,在这种情况下,由于各种原因(包括使用最新的2.7.x的能力),我更倾向于从源代码构建。我曾尝试检查用于Python软件包安装的配置选项,但在我自己的Docker构建中使用这些选项似乎也没有安装模块。
通过apt:
安装fpectl
尽管如此,我缺少什么?是否需要一些额外的系统包来启用此模块,或者在配置步骤中需要一些额外的标志?