我是一个没有经验的 Linux 用户,但已经折腾了几个月。我需要在一个项目中使用 python 3.5-3.7,但无法从 tarball 安装 python3.7,如下所述:在 Ubuntu 20.04 中安装 Python 3.7 软件包
我在这里提供了终端的输出:(抱歉,太长了,我不知道什么是相关的)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-spo6ltjl
cwd: /tmp/pip-req-build-_od32i_x/
Complete output (230 lines):
running bdist_wheel
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ctypes_test' extension
creating build/temp.linux-x86_64-3.8/_ctypes
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _ctypes/_ctypes_test.c -o build/temp.linux-x86_64-3.8/_ctypes/_ctypes_test.o
x86_64-linux-gnu-gcc: error: _ctypes/_ctypes_test.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_contextvars' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _contextvarsmodule.c -o build/temp.linux-x86_64-3.8/_contextvarsmodule.o
x86_64-linux-gnu-gcc: error: _contextvarsmodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_json' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _json.c -o build/temp.linux-x86_64-3.8/_json.o
x86_64-linux-gnu-gcc: error: _json.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_testcapi' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _testcapimodule.c -o build/temp.linux-x86_64-3.8/_testcapimodule.o
x86_64-linux-gnu-gcc: error: _testcapimodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_testbuffer' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _testbuffer.c -o build/temp.linux-x86_64-3.8/_testbuffer.o
x86_64-linux-gnu-gcc: error: _testbuffer.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_testimportmultiple' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _testimportmultiple.c -o build/temp.linux-x86_64-3.8/_testimportmultiple.o
x86_64-linux-gnu-gcc: error: _testimportmultiple.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_testmultiphase' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _testmultiphase.c -o build/temp.linux-x86_64-3.8/_testmultiphase.o
x86_64-linux-gnu-gcc: error: _testmultiphase.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_lsprof' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _lsprof.c -o build/temp.linux-x86_64-3.8/_lsprof.o
x86_64-linux-gnu-gcc: error: _lsprof.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_opcode' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _opcode.c -o build/temp.linux-x86_64-3.8/_opcode.o
x86_64-linux-gnu-gcc: error: _opcode.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_asyncio' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _asynciomodule.c -o build/temp.linux-x86_64-3.8/_asynciomodule.o
x86_64-linux-gnu-gcc: error: _asynciomodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_queue' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _queuemodule.c -o build/temp.linux-x86_64-3.8/_queuemodule.o
x86_64-linux-gnu-gcc: error: _queuemodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'parser' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c parsermodule.c -o build/temp.linux-x86_64-3.8/parsermodule.o
x86_64-linux-gnu-gcc: error: parsermodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'mmap' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c mmapmodule.c -o build/temp.linux-x86_64-3.8/mmapmodule.o
x86_64-linux-gnu-gcc: error: mmapmodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_xxtestfuzz' extension
creating build/temp.linux-x86_64-3.8/_xxtestfuzz
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _xxtestfuzz/_xxtestfuzz.c -o build/temp.linux-x86_64-3.8/_xxtestfuzz/_xxtestfuzz.o
x86_64-linux-gnu-gcc: error: _xxtestfuzz/_xxtestfuzz.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'audioop' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c audioop.c -o build/temp.linux-x86_64-3.8/audioop.o
x86_64-linux-gnu-gcc: error: audioop.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_crypt' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _cryptmodule.c -o build/temp.linux-x86_64-3.8/_cryptmodule.o
x86_64-linux-gnu-gcc: error: _cryptmodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_ssl' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _ssl.c -o build/temp.linux-x86_64-3.8/_ssl.o
x86_64-linux-gnu-gcc: error: _ssl.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_hashlib' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _hashopenssl.c -o build/temp.linux-x86_64-3.8/_hashopenssl.o
x86_64-linux-gnu-gcc: error: _hashopenssl.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'termios' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c termios.c -o build/temp.linux-x86_64-3.8/termios.o
x86_64-linux-gnu-gcc: error: termios.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'resource' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c resource.c -o build/temp.linux-x86_64-3.8/resource.o
x86_64-linux-gnu-gcc: error: resource.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'nis' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c nismodule.c -o build/temp.linux-x86_64-3.8/nismodule.o
x86_64-linux-gnu-gcc: error: nismodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_curses' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_NCURSESW=1 -I/usr/include/ncursesw -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _cursesmodule.c -o build/temp.linux-x86_64-3.8/_cursesmodule.o
x86_64-linux-gnu-gcc: error: _cursesmodule.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_curses_panel' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_NCURSESW=1 -I/usr/include/ncursesw -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _curses_panel.c -o build/temp.linux-x86_64-3.8/_curses_panel.o
x86_64-linux-gnu-gcc: error: _curses_panel.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_multibytecodec' extension
creating build/temp.linux-x86_64-3.8/cjkcodecs
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/multibytecodec.c -o build/temp.linux-x86_64-3.8/cjkcodecs/multibytecodec.o
x86_64-linux-gnu-gcc: error: cjkcodecs/multibytecodec.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_kr' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_kr.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_kr.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_kr.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_jp' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_jp.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_jp.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_jp.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_cn' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_cn.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_cn.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_cn.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_tw' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_tw.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_tw.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_tw.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_hk' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_hk.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_hk.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_hk.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_codecs_iso2022' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c cjkcodecs/_codecs_iso2022.c -o build/temp.linux-x86_64-3.8/cjkcodecs/_codecs_iso2022.o
x86_64-linux-gnu-gcc: error: cjkcodecs/_codecs_iso2022.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_decimal' extension
creating build/temp.linux-x86_64-3.8/_decimal
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCONFIG_64=1 -DASM=1 -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _decimal/_decimal.c -o build/temp.linux-x86_64-3.8/_decimal/_decimal.o
x86_64-linux-gnu-gcc: error: _decimal/_decimal.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_multiprocessing' extension
creating build/temp.linux-x86_64-3.8/_multiprocessing
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -IModules/_multiprocessing -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _multiprocessing/multiprocessing.c -o build/temp.linux-x86_64-3.8/_multiprocessing/multiprocessing.o
x86_64-linux-gnu-gcc: error: _multiprocessing/multiprocessing.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'ossaudiodev' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c ossaudiodev.c -o build/temp.linux-x86_64-3.8/ossaudiodev.o
x86_64-linux-gnu-gcc: error: ossaudiodev.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building 'xxlimited' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_LIMITED_API=0x03050000 -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c xxlimited.c -o build/temp.linux-x86_64-3.8/xxlimited.o
x86_64-linux-gnu-gcc: error: xxlimited.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
building '_ctypes' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/x86_64-linux-gnu -I. -IObjects -IInclude -IPython -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/include/python3.8 -c _ctypes/_ctypes.c -o build/temp.linux-x86_64-3.8/_ctypes/_ctypes.o
x86_64-linux-gnu-gcc: error: _ctypes/_ctypes.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _dbm _elementtree
_gdbm _lzma _sqlite3
_tkinter _uuid readline
spwd
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc _bisect _blake2
_csv _datetime _heapq
_md5 _pickle _posixsubprocess
_random _sha1 _sha256
_sha3 _sha512 _socket
_struct array atexit
binascii cmath fcntl
grp math pwd
pyexpat select syslog
time unicodedata zlib
Failed to build these modules:
_asyncio _codecs_cn _codecs_hk
_codecs_iso2022 _codecs_jp _codecs_kr
_codecs_tw _contextvars _crypt
_ctypes _ctypes_test _curses
_curses_panel _decimal _hashlib
_json _lsprof _multibytecodec
_multiprocessing _opcode _queue
_ssl _testbuffer _testcapi
_testimportmultiple _testmultiphase _xxtestfuzz
audioop mmap nis
ossaudiodev parser resource
termios xxlimited
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
running build_scripts
creating build/scripts-3.8
error: [Errno 2] No such file or directory: '/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Tools/scripts/pydoc3'
----------------------------------------
ERROR: Failed building wheel for Python
Running setup.py clean for Python
Failed to build Python
Installing collected packages: Python
Running setup.py install for Python ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kzs09dnd/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/beany_lass/.local/include/python3.8/Python
cwd: /tmp/pip-req-build-_od32i_x/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-_od32i_x/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kzs09dnd/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/beany_lass/.local/include/python3.8/Python Check the logs for full command output.
答案1
对于较新的 Python,我更喜欢死蛇 ppa。要安装它,请尝试以下操作:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
$ python3.7 -V
Python 3.7.7
答案2
通过运行以下命令,可以在 Ubuntu 20.04 中安装来自官方 Ubuntu 19.10 存储库的 Python 3.7 软件包,而无需向软件源添加任何新存储库:
sudo apt update
wget -c http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-9_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/libpython3.7-stdlib_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/libpython3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/python3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/python3.7_3.7.5-2~19.10ubuntu1_amd64.deb
sudo apt install ./libffi6_3.2.1-9_amd64.deb ./libpython3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb ./libpython3.7-stdlib_3.7.5-2~19.10ubuntu1_amd64.deb ./python3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb ./python3.7_3.7.5-2~19.10ubuntu1_amd64.deb
将 Python 3.7 添加到 update-alternatives ,以便您可以通过运行在 Python 3.8 和 Python 3.7 之间切换update-alternatives --config python3
。
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7
update-alternatives --config python3