python安装时出现高山错误

我需要将 Shapely 安装到基于Python + Alpine的docker容器中。我在容器中已经拥有的东西:

make,gcc,geos-dev,musl-dev

我用这个命令得到了什么: pip安装正常

Collecting shapely
  Downloading https://files.pythonhosted.org/packages/a2/fb/7a7af9ef7a35d16fa23b127abee272cfc483ca89029b73e92e93cdf36e6b/Shapely-1.6.4.post2.tar.gz (225kB)
     |████████████████████████████████| 235kB 641kB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vj51jvsy/shapely/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vj51jvsy/shapely/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-vj51jvsy/shapely/pip-egg-info
         cwd: /tmp/pip-install-vj51jvsy/shapely/
    Complete output (11 lines):
    Failed `CDLL(libgeos_c.so.1)`
    Failed `CDLL(libgeos_c.so)`
    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "/tmp/pip-install-vj51jvsy/shapely/setup.py",line 80,in <module>
        from shapely._buildcfg import geos_version_string,geos_version,\
      File "/tmp/pip-install-vj51jvsy/shapely/shapely/_buildcfg.py",line 167,in <module>
        fallbacks=['libgeos_c.so.1','libgeos_c.so'])
      File "/tmp/pip-install-vj51jvsy/shapely/shapely/_buildcfg.py",line 161,in load_dll
        libname,fallbacks or []))
    OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1','libgeos_c.so']
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我在Google上搜索了很多时间,但是找不到任何解决方法。

Dockerfile

FROM python:3.7-alpine

RUN ["mkdir","/home/test"]
WORKDIR /home/test

RUN echo "http://mirror.leaseweb.com/alpine/edge/testing" >> /etc/apk/repositories
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN ["apk","add","make","gcc","geos-dev","musl-dev"]
RUN ["pip3","install","virtualenv","--no-warn-script-location","--disable-pip-version-check"]
RUN ["virtualenv",".env","--python=python3"]
RUN ["pip3","shapely"]

CMD ["/bin/sh"]

容器内的Python版本

/home/test # /usr/local/bin/python
Python 3.7.5 (default,Oct 21 2019,20:13:45) 
[GCC 8.3.0] on linux
Type "help","copyright","credits" or "license" for more information.
>>> 

GEOS版本

/home/test # geos-config --version
3.7.2

已更新

现在,您必须将此存储库置于其他存储库的下方:

--repository http://dl-cdn.alpinelinux.org/alpine/edge/community
why111333 回答:python安装时出现高山错误

这将起作用:

r.join(
    r.groupBy("id").count().as("g"),$"g.id" === r("id")
  )
  .withColumn(
    "ID_EMPLOYE_VENDEUR",expr("if(count != 1,null,ID_EMPLOYE_VENDEUR)")
  )
  .drop($"g.id").drop("count")
  .distinct()
  .show()

请参阅this

更新:根据评论,r已移至id回购。

,

我的构建也遇到了这个问题。我的解决方法是从Alpine切换到Debian(不理想,但允许我使用旧版本的geos),因为看来最新版本的geos与shape不兼容。

本文链接:https://www.f2er.com/3163997.html

大家都在问