Shapely: 无法使用 pipenv 和 cx_freeze 打包:OSError:找不到 lib geos_c.dll 或加载其任何变体 []

创建于 2020-09-16  ·  3评论  ·  资料来源: Toblerity/Shapely

预期行为和实际行为。

当使用 cx_freeze 将我的 python3.8 程序冻结到 msi 中时,msi 可以在构建它的计算机上运行,​​但不能在其他主机上运行。
错误信息是: OSError: Could not find lib geos_c.dll or load any of its variants [].

重现问题的步骤。

点文件:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
cx_Freeze = "==6.2"
shapely = "==1.7.1"

[requires]
python_version = "3.8"

[scripts]
build = "python setup.py bdist_msi"

设置.py:

from cx_Freeze import setup, Executable

if __name__ == "__main__":
    APP = Executable(
        script="test.py",
        base=None,
        targetName="test",  # executable name avaiable in cli after installation
    )

    setup(
        name="test",
        options={
            "build_exe": {},
            "bdist_msi": {
                "add_to_path": True,
                "all_users": True,  # require admin rights
            },
        },
        executables=[APP],
    )

测试.py:

from shapely.geometry import LineString

pallet_line_string = LineString(
    [
        (0, 0),
        (10, 0),
        (10, 20),
        (0, 20),
        (0, 0),
    ]
)
print(pallet_line_string)

操作系统

视窗 10

匀称的版本和出处

1.7.1 使用 pipenv 从 PyPI 安装

invalid

最有用的评论

错误消息具有误导性:确实找到了geos_c.dll ,但它不是我们的依赖项。 我必须安装 Microsoft 的 VC Redistributables 才能让它工作。
谢谢!

所有3条评论

@ypicard很抱歉给您带来麻烦,但这不是一个问题。 您必须弄清楚如何在包中包含兼容的 geos_c.dll。 以下是我们如何为基于 appveyor 构建的匀称轮子执行此操作: https://github.com/Toblerity/Shapely/blob/maint-1.7/appveyor.yml#L84。

问题是,dll 已经正确打包。 我可以在我的程序的安装目录中找到它们( C:\Program Files (x86)\my_program\lib\shapely\DLLs )。 它们似乎被正确捆绑。
问题是 shapely 无法正确加载它们。 我在geos.py:166处打印了路径,$ egg_dllswininst_dlls看起来都是正确的。
怎么了 ?

错误消息具有误导性:确实找到了geos_c.dll ,但它不是我们的依赖项。 我必须安装 Microsoft 的 VC Redistributables 才能让它工作。
谢谢!

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

LostFan123 picture LostFan123  ·  3评论

jrobichaud picture jrobichaud  ·  3评论

dopplershift picture dopplershift  ·  3评论

LostFan123 picture LostFan123  ·  3评论

LostFan123 picture LostFan123  ·  5评论