小编tsa*_*sao的帖子

由于导入opencv时缺少DLL,py2exe无法创建EXE

我是一个Python和编码新手.我试图搜索帖子,但似乎我找不到其他面临同样的问题.

我在Windows 10上使用Python 2.7和opencv3.0.

我尝试使用py2exe将.py文件转换为EXE文件.但是,命令窗口告诉我.

error: [Errno 2] No such file or directory: 'api-ms-win-core-registry-l1-1-0.dll'
Run Code Online (Sandbox Code Playgroud)

这是我的setup.py

from distutils.core import setup
import py2exe
import matplotlib
import FileDialog
setup(windows=['HW6.py'],
      options={
                'py2exe': { 
                "includes" : ["matplotlib.backends.backend_tkagg","cv2"],

                'excludes': ['_gtkagg', '_tkagg', '_agg2', '_cairo','_cocoaagg', 
                              "matplotlib.numerix.fft","sip", "PyQt4._qt",
                              "matplotlib.backends.backend_qt4agg",
                              "matplotlib.numerix.linear_algebra", 
                              "matplotlib.numerix.random_array",
                             '_fltkagg', '_gtk','_gtkcairo' ],

                'dll_excludes': ['libgdk-win32-2.0-0.dll',
                                 'libgobject-2.0-0.dll' ,
                                 'MSVCP90.dll']
              }

                },

      data_files=matplotlib.get_py2exe_datafiles(),) 
Run Code Online (Sandbox Code Playgroud)

在我排除'api-ms-win-core-registry-l1-1-0.dll'之后,另一个错误弹出并说

error: [Errno 2] No such file or directory: 'api-ms-win-core-errorhandling-l1-1-1.dll'
Run Code Online (Sandbox Code Playgroud)

在我排除了大量的DLL之后,仍然缺少一些DLL.以下是我排除的内容

'api-ms-win-core-string-l1-1-0.dll',
'api-ms-win-core-registry-l1-1-0.dll',
'api-ms-win-core-errorhandling-l1-1-1.dll',
'api-ms-win-core-string-l2-1-0.dll',
'api-ms-win-core-profile-l1-1-0.dll',
'api-ms-win-core-processthreads-l1-1-2.dll',
'api-ms-win-core-libraryloader-l1-2-1.dll',
'api-ms-win-core-file-l1-2-1.dll',
'api-ms-win-security-base-l1-2-0.dll',
'api-ms-win-eventing-provider-l1-1-0.dll',
'api-ms-win-core-heap-l2-1-0.dll',
'api-ms-win-core-libraryloader-l1-2-0.dll',
'api-ms-win-core-localization-l1-2-1.dll',
'api-ms-win-core-sysinfo-l1-2-1.dll',
'api-ms-win-core-synch-l1-2-0.dll',
'api-ms-win-core-heap-l1-2-0.dll' …
Run Code Online (Sandbox Code Playgroud)

python dll opencv

8
推荐指数
1
解决办法
6193
查看次数

标签 统计

dll ×1

opencv ×1

python ×1