ScoreDraft icon indicating copy to clipboard operation
ScoreDraft copied to clipboard

ScoreDraft 模块无法导入

Open ZeroAurora opened this issue 7 years ago • 9 comments

运行任意一个 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: 找不到指定的模块。

ZeroAurora avatar Jul 16 '18 06:07 ZeroAurora

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.

fynv avatar Jul 16 '18 06:07 fynv

也就是说现在没有预编译模块了?

ZeroAurora avatar Jul 16 '18 09:07 ZeroAurora

啊抱歉,如果是下载后直接运行例子是不应该出现这个问题的。 请检查以下可能的问题:

  1. python_test/ScoreDraft/PyScoreDraft.pyd 是否因某种原因丢失
  2. 操作系统是否为64位Windows. 32位系统这个模块是不兼容的
  3. 系统中是否存在Python 2.x. 如果有的话,请尝试以下指令运行: python_test> python3 Hello.py

fynv avatar Jul 16 '18 09:07 fynv

三问题均无

ZeroAurora avatar Jul 16 '18 09:07 ZeroAurora

我看了一下PyScoreDraft.pyd依赖的其他DLL:

PYTHON36.DLL : 看来你的python必须是3.6版本才能直接用这个build KERNEL32.DLL: 没什么好说 MSVCP120.DLL & MSVCR120.DLL: 需要VC2013的 Runtime (vcredist_x64)

以上我能想到的。

fynv avatar Jul 16 '18 12:07 fynv

必须是 py3.6?我装的 py 3.7

ZeroAurora avatar Jul 16 '18 13:07 ZeroAurora

估摸着要自己编译一份了

ZeroAurora avatar Jul 16 '18 13:07 ZeroAurora

I tried in my python that pre-installed in my system and it does not work: image

However, WinPython and Anaconda work flawlessly: image image

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.

LovelyA72 avatar Feb 20 '19 00:02 LovelyA72

确实,用Python Extension这种方式会导致只兼容固定的Python版本,我回头用Python3.7编译一份去。

fynv avatar Feb 20 '19 02:02 fynv