【问题标题】:uWSGI fails to build from pip on ubuntu 18.04uWSGI 无法在 ubuntu 18.04 上从 pip 构建
【发布时间】:2018-12-05 13:53:41
【问题描述】:

尝试从命令行安装 uWSGI

pip install uwsgi

导致堆栈跟踪很长,这里是它的结尾:

/usr/bin/x86_64-linux-gnu-ld: /usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a(parser.o):
 relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; 
recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
*** error linking uWSGI ***

    ----------------------------------------
Command "/home/user/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ve0nx9k8/uwsgi/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-l_7f937a/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/venv/include/site/python3.6/uwsgi" failed with error code 1 in /tmp/pip-install-ve0nx9k8/uwsgi/

我正在使用 Python 3.6。 Python 2 有效,Python 3.7 有效,但不幸的是我需要使用 Python 3.6。虚拟环境中没有其他东西,这是对 ubuntu 的全新重新安装。

【问题讨论】:

标签: python ubuntu pip uwsgi


【解决方案1】:

我在尝试使用系统 python 构建时遇到此错误。当我切换到pyenv 并安装了自定义python 版本时,uWSGI 安装正常。

【讨论】:

    【解决方案2】:

    这个错误意味着链接器想要构建一个Position I独立的E可执行文件(PIE对象),但它不能因为库libpython3.6m.a 是在没有这种链接支持的情况下构建的。

    我在使用通过pyenv 安装的 Python 时遇到了这个问题。

    要解决这种情况下的问题,请使用特殊的编译器标志重新安装 Python:

    CONFIGURE_OPTS=--enable-shared pyenv install 3.7.7  # use your Python version
    

    这在他们的wiki 中有所提及,但对我来说,不清楚何时需要此类标志。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-20
      • 2020-04-06
      • 1970-01-01
      • 1970-01-01
      • 2017-07-08
      • 2019-04-12
      • 1970-01-01
      相关资源
      最近更新 更多