在 Windows 上安装 pyflycapture2 时出错

Error installing pyflycapture2 on Windows

我正在尝试在我的 Windows 机器上安装此 https://github.com/jordens/pyflycapture2 python 绑定。自述文件只有关于如何为 Linux 系统执行此操作的说明,但我认为该库应该仍然有效。

我能够 运行 "python setup.py install" 并且它似乎成功完成,但是当我尝试 运行 "python test_flycapture2.py" 我得到这个错误:

C:\Users\clinic\Desktop\pyflycapture2>python test_flycapture2.py Traceback (most recent call last):   
File "test_flycapture2.py", line 20, in <module>
    import flycapture2 as fc2   
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>   
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.

这似乎暗示 flycapture2 没有正确安装。当我打开 python 会话并执行 "import flycapture2" 时,我收到以下错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.

是我在安装过程中做错了什么,还是 pyflycapture2 不能与 Windows 一起使用?

一个值得一试的愚蠢解决方案。有可能直接从您启动 python 脚本的位置搜索 DLL。因此,如果您的计算机上有 dll,请将其复制到 test_flycapture2.py.

所在的位置

但考虑到 setup.py 文件中有一大堆绝对路径,我不会寄予太大希望。您也可以尝试在完全相同的路径下安装 FlyCapture 2,在 pyflycapture2 文件夹中 运行 python setup.py bdist_wheel(您需要先使用 pip 安装 wheel),然后查看是否成功。

如果是,请尝试通过执行 pip install dist/pyfly....wheel 安装生成的轮子(将在 dist/ 子文件夹中)并再次测试。

希望对您有所帮助

我之所以回答这个问题,主要是因为我发现另一个 post 那里有同样的问题 posted 但原始问题从未得到回答。

在评论中,原poster说突然开始工作了。我发现解决方案很简单,就是重新启动计算机。我现在已经在两台计算机上进行了尝试,这对它们都有效。