【发布时间】:2020-12-08 21:53:12
【问题描述】:
我试图在 Python 3.8 上安装 Twisted。我知道 Twisted 还不支持 Python 3.8,这就是 pip install 尝试从源代码构建它的原因。但是我的 Linux 机器上的 gcc 版本较低,我不想升级它。有没有办法告诉pip 使用gcc 4.8.5 来构建twisted?
这是我直接从pip install Twisted==20.3.0得到的错误
... ...
running build_ext
building 'twisted.test.raiser' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
creating build/temp.linux-x86_64-3.8/src/twisted
creating build/temp.linux-x86_64-3.8/src/twisted/test
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fPIC -I/path/to/venv38/include -I/path/to/python3.8 -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-3.8/src/twisted/test/raiser.o
gcc: error: unrecognized command line option ‘-fno-semantic-interposition’
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /path/to/venv38/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ovoof0ve/twisted/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ovoof0ve/twisted/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-3ftmx451/install-record.txt --single-version-externally-managed --compile --install-headers /path.to/venv38/include/site/python3.8/Twisted Check the logs for full command output.
$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
【问题讨论】: