ScoreDraft 模块无法导入
运行任意一个 python_test 目录下的示例,得出如下 Traceback:
Traceback (most recent call last):
File "C:\Users\zeroa\repos\ScoreDraft-master\python_test\Hello.py", line 3, in <module>
import ScoreDraft
File "C:\Users\zeroa\repos\ScoreDraft-master\python_test\ScoreDraft\__init__.py", line 2, in <module>
from . import PyScoreDraft
ImportError: DLL load failed: 找不到指定的模块。
In ReadMe, I said:
Run CMake to generate makefiles/project files for your system and build. You are recommanded to:
use the /build directory as you building directory i
use /python_test as your CMAKE_INSTALL_PREFIX
In Windows, you can set the variable CMAKE_INSTALL_PREFIX in the cmake GUI. If CMAKE_INSTALL_PREFIX is already pointed to "python_test", you just need to build the "INSTALL" project in VS after "BUILD_ALL" succeeded.
也就是说现在没有预编译模块了?
啊抱歉,如果是下载后直接运行例子是不应该出现这个问题的。 请检查以下可能的问题:
- python_test/ScoreDraft/PyScoreDraft.pyd 是否因某种原因丢失
- 操作系统是否为64位Windows. 32位系统这个模块是不兼容的
- 系统中是否存在Python 2.x. 如果有的话,请尝试以下指令运行: python_test> python3 Hello.py
三问题均无
我看了一下PyScoreDraft.pyd依赖的其他DLL:
PYTHON36.DLL : 看来你的python必须是3.6版本才能直接用这个build KERNEL32.DLL: 没什么好说 MSVCP120.DLL & MSVCR120.DLL: 需要VC2013的 Runtime (vcredist_x64)
以上我能想到的。
必须是 py3.6?我装的 py 3.7
估摸着要自己编译一份了
I tried in my python that pre-installed in my system and it does not work:

However, WinPython and Anaconda work flawlessly:

So, in conclusion, I think the problem can be the reason that Python 3.7 is not supported in ScoreDraft. You can try to grab a copy of WinPython (with Python 3.6) since it's portable and does not require an uninstallation to get rid of it.
确实,用Python Extension这种方式会导致只兼容固定的Python版本,我回头用Python3.7编译一份去。