在Linux上使用Python模块编译GEOS 3.6.2

时间:2018-03-29 16:52:22

标签: python linux python-3.x python-3.6 geos

尝试在已编译Python 3.6.4的Linux系统上安装GEOS-3.6.2。 我正在尝试使用以下命令创建包:

export PYTHON=/usr/local/bin/python3 && make && sudo make install

configure命令失败,显示:

...much snipped...
checking for swig... /usr/bin/swig
checking for SWIG version... 3.0.8
configure: SWIG executable is '/usr/bin/swig'
configure: SWIG library directory is '/usr/share/swig3.0'
checking for python version... 3.6
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.6/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.6/site-packages
checking for Python include path... /usr/local/include/python3.6m
checking for Python library path... 
configure: error: cannot find Python library path

我已经确认Python库存在于/ usr / local / lib / python3.6 / config-3.6m-x86_64-linux-gnu / libpython3.6m.a`

我用简单的./configure --prefix=/usr/local && make && sudo make install

编译了python

系统资料:

~/Downloads/geos-3.6.2$ uname -a
Linux Sleipnir 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
~/Downloads/geos-3.6.2$ which python3
/usr/local/bin/python3
~/Downloads/geos-3.6.2$ python3 -V
Python 3.6.4
~$ cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

1 个答案:

答案 0 :(得分:0)

感谢Knud上面的评论能够让GEOS正确编译。 Python现在配置了./configure --prefix=/usr/local --enable-shared,后跟sudo ldconfig -v /usr/local/lib

遵循这些行动,GEOS与export PYTHON=/usr/local/bin/python3 && ./configure --prefix=/usr/local --enable-python && make && sudo make install

编译得很好

更新:在尝试在另一个系统上构建GEOS时,我又遇到了这个问题。这次解决方案略有不同。 Python编译构建库,文件名为libpython3.6m.so.1.0。 GEOS配置正在寻找libpython$PYTHON_VERSION.*的模式。如果确定python版本为3.6,这个系统正在返回,那么由于添加了'm',构建将失败。

额外的FIX是在库目录中添加符号链接ln -s libpython3.6m.1.0 libpython3.6.so