[英]Installing GDCM on Windows -- ImportError
I am trying to install GDCM on Windows (10, x64) so I can use the GDCM package with Python 3.6.5, and am finding it completely impossible.我正在尝试在 Windows (10, x64) 上安装 GDCM,这样我就可以使用 GDCM package 和 Python 和 3.6.
I have tried every combination of:我尝试了以下每种组合:
The best I can get is copying the above mentioned files to site-packages, which allows python to detect the gdcm package (when the files are removed from site-packages it detects nothing), but returns the error:我能得到的最好的是将上述文件复制到站点包,这允许 python 检测 gdcm package (当文件从站点包中删除时它什么也没检测到),但返回错误:
>>> 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.
Installing the _x86 version instead returns the error "%1 is not a Valid Win32 application".安装 _x86 版本会返回错误“%1 不是有效的 Win32 应用程序”。
I downloaded dependencyWalker to analyse _gdcmswig.pyd, but from this I cannot understand much.我下载了dependencyWalker来分析_gdcmswig.pyd,但从中我无法理解太多。 The problem is not MSVCP100.dll, as I have vc_redist_x64 installed.问题不在于 MSVCP100.dll,因为我安装了 vc_redist_x64。 It does mention Python34.dll, but the answer below got the exact same installer working on Python 3.6.它确实提到了 Python34.dll,但下面的答案得到了在 Python 3.6 上工作的完全相同的安装程序。
The solution mentioned at: how to install gdcm python wrapping on Windows System?提到的解决方案: 如何在 Windows 系统上安装 gdcm python 包装? does not work for me.对我不起作用。
Lastly, I cannot get python to detect the package from the Program Files/GDCM 2.8/bin, regardless of what is in PATH, PYTHONPATH, or PYTHONHOME;最后,我无法让 python 从 Program Files/GDCM 2.8/bin 中检测 package,无论 PATH、PYTHONPATH 或 PYTHONHOME 中有什么; I don't know if this is normal or not.我不知道这是否正常。
I have spent hours on this, to no avail;我花了几个小时在这上面,但无济于事; any help is greatly appreciated.任何帮助是极大的赞赏。
For posterity: 对于后代:
For me, it seems the issue was indeed that the official provided binaries were compiled for Python 3.4; 对我来说,问题似乎确实是官方提供的二进制文件是针对Python 3.4编译的; I have no idea how this person got the same installer working on Python 3.6. 我不知道这个人如何在Python 3.6上获得相同的安装程序。
The solution was to build the package binaries myself ; 解决方法是自己构建软件包二进制文件 ; there was no "one-click" solution. 没有“一键式”解决方案。 For my ridiculously convoluted adventure in troubleshooting this problem, see: https://motivatedbylaziness.wordpress.com/2018/07/06/the-impossible-journey-of-a-simple-task/ 对于我在解决此问题时的令人费解的冒险之旅,请参阅: https : //motivatedbylaziness.wordpress.com/2018/07/06/the-impossible-journey-of-a-simple-task/
I recently had this issue, and I solved it using:我最近遇到了这个问题,我使用以下方法解决了它:
python -m pip install python-gdcm
It seems that today (2022) there is a "one-click" solution看来今天(2022)有“一键式”解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.