如何使用fpectl模块从源代码安装Python 2.7?
我正在尝试从Docker容器中的源代码安装Python 2.7.14,并且启用了模块 使用作为起点,我将配置选项添加到如何使用fpectl模块从源代码安装Python 2.7?,python,python-2.7,docker,debian-jessie,sigfpe,Python,Python 2.7,Docker,Debian Jessie,Sigfpe,我正在尝试从Docker容器中的源代码安装Python 2.7.14,并且启用了模块 使用作为起点,我将配置选项添加到/configure命令中 您可以看到我的docker build命令的完整输出;然而,这里有一些有趣的地方: ./configure --build=x86_64-linux-gnu --enable-shared --enable-unicode=ucs4 --with-fpectl ... checking for --with-fpectl... yes ... x86_
/configure
命令中
您可以看到我的docker build命令的完整输出;然而,这里有一些有趣的地方:
./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
的错误消息是良性的,但我认为应该将其包含在上下文中,因为它是唯一与fpectl
模块相关的其他输出。)
当我使用此构建创建的映像启动容器时,我有一个正常的Python安装,但没有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
说了这么多,我错过了什么?是否需要一些额外的系统包来启用此模块,或者在配置步骤中需要一些额外的标志?使用numpy不需要这些标志。谢谢,我已经澄清了一些要求。
root@54895ad345bb:/# apt-get install -y python
...
root@54895ad345bb:/# /usr/bin/python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpectl
# no import error!
>>> import sysconfig
>>> print(sysconfig.get_config_var('CONFIG_ARGS'))
'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro'