gpt4 book ai didi

python - 在 Windows 上安装 GDCM -- ImportError

转载 作者:可可西里 更新时间:2023-11-01 11:43:51 25 4
gpt4 key购买 nike

我正在尝试在 Windows(10、x64)上安装 GDCM,以便我可以将 GDCM 包与 Python 3.6.5 一起使用,但我发现这完全不可能。

我已经尝试了以下所有组合:

  • 安装 GDCM-2.8.7-Windows-x86_64、GDCM-2.8.7-Windows-x86.exe、GDCM-2.8.4-Windows-x86.exe(当然是单独安装)
  • 添加到 PYTHONPATH:C:\Program Files\Python36; C:\Program Files\Python36\Lib; C:\Program Files\Python36\DLLs; C:\Program Files\Python36\Scripts; C:\Program Files\GDCM 2.8; C:\Program Files\GDCM 2.8\lib; C:\Program Files\GDCM 2.8\bin; C:\Program Files\GDCM 2.8\include; C:\Program Files\GDCM 2.8\(甚至 PYTHONHOME)
  • 将文件 gdcm.py、gdcmswig.py 和 _gdcmswig.pyd 复制到站点包和 DLL 中

我能得到的最好的办法是将上述文件复制到站点包,这允许 python 检测 gdcm 包(当文件从站点包中删除时,它什么也检测不到),但返回错误:

>>> import gdcm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python36\lib\site-packages\gdcm.py", line 68, in
<module>
from gdcmswig import *
File "C:\Program Files\Python36\lib\site-packages\gdcmswig.py", line 20, in
<module>
_gdcmswig = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\gdcmswig.py", line 19, in
swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.

安装 _x86 版本会返回错误“%1 不是有效的 Win32 应用程序”。

我下载了dependencyWalker来分析_gdcmswig.pyd,但是从中我不能理解太多。问题不在于 MSVCP100.dll,因为我安装了 vc_redist_x64。它确实提到了 Python34.dll,但下面的答案得到了在 Python 3.6 上运行的完全相同的安装程序。

解决方法在: how to install gdcm python wrapping on Windows System?对我不起作用。

最后,无论 PATH、PYTHONPATH 或 PYTHONHOME 中有什么,我都无法让 python 从 Program Files/GDCM 2.8/bin 中检测包;我不知道这是否正常。

我为此花了几个小时,但无济于事;非常感谢任何帮助。

最佳答案

为了后代:

对我来说,问题似乎确实是官方提供的二进制文件是为 Python 3.4 编译的;我不知道如何this person在 Python 3.6 上使用相同的安装程序。

解决方案是自己构建二进制包;没有“一键式”解决方案。对于我解决此问题的荒谬而复杂的冒险,请参阅:https://motivatedbylaziness.wordpress.com/2018/07/06/the-impossible-journey-of-a-simple-task/

关于python - 在 Windows 上安装 GDCM -- ImportError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51196377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com