【问题标题】:How to configure python with --enable-shared on Ubuntu 18.04如何在 Ubuntu 18.04 上使用 --enable-shared 配置 python
【发布时间】:2019-04-27 01:58:33
【问题描述】:

我有一个烧瓶应用程序,我正在尝试将其部署到 heroku。我正在尝试通过我运行 ubuntu 18.04 的虚拟机来执行此操作。

上命令:git push heroku master

我看到一个警告:

WARNING: The Python installation you are using does not appear to have  
  been installed with a shared library, or in the case of MacOS X, as a
  framework. Where these are not present, the compilation of mod_wsgi may
  fail, or if it does succeed, will result in extra memory being used by all 
  processes at run time as a result of the static library needing to
   be loaded in its entirety to every process. It is highly recommended
   that you reinstall the Python installation being used from source code,
   supplying the '--enable-shared' option to the 'configure' script when
    configuring the source code prior to building and installing it.

它失败并显示错误消息:

/usr/bin/ld: final link failed: Bad value
remote:            collect2: error: ld returned 1 exit status
remote:            error: command 'gcc' failed with exit status 1

我知道我需要在“配置”脚本中安装带有 --enable-shared 标志的 python。但我似乎根本没有在 bin 或 python 文件夹下的 python 安装中找到配置脚本。这就是我自 3 天以来一直被困的地方,令人沮丧;我真的不知道如何用这样的标志重新安装 python .. 在浏览了很多帖子后,我尝试了以下步骤:

1)从url下载的python:https://www.python.org/downloads/source/

2) 运行命令:./configure --prefix=/opt/python --enable-shared

后跟制作

然后进行安装

3) 将共享对象文件复制到我原来的python目录中

命令的输出:ldd ** path **/anaconda3/bin/python 给我:

libpython3.6m.so.1.0 => /usr/anaconda3/bin/../lib/libpython3.6m.so.1.0 
(0x00007f902dd2e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 
(0x00007f902db0e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f902d906000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f902d6fe000)
 librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f902d4f6000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f902d156000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f902cd5e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f902e26e000)

然而,当我尝试部署应用程序时,我看到了相同的 --enable-shared 警告和 gcc 的相同错误消息。我似乎无法弄清楚如何正确启用我的 python 安装以具有共享对象。请注意,我是 ubuntu 的新手,我非常感谢解决这个问题的任何线索。

P.S:我的 mod_wsgi 安装成功,我可以通过 mod_wsgi 在本地运行应用程序。

【问题讨论】:

  • 伙计们,我已经做了一个多星期了,我完全无法自己解决这个问题.....如果有人能提供任何线索,我将不胜感激.我真的指望专家的建议来解决这个问题......
  • 有人可以看看这个吗??

标签: python-3.x heroku flask mod-wsgi ubuntu-18.04


【解决方案1】:

如果你不需要使用python3的自定义构建,你可以尝试通过apt安装python3.6-dev包,它为我添加了共享库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-08
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多