如何使用--enable配置python在Ubuntu 18.04上共享



我有一个flask应用程序,我正试图将其部署到heroku。我正试图通过我运行ubuntu 18.04的虚拟盒子来做到这一点。

上命令:git-push-heroku主

我看到警告:

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

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

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

2( 运行命令:/configure--prefix=/opt/python--启用共享

然后制作

并安装

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的新手,我真的很感激任何解决这个问题的线索。

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

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

相关内容

最新更新