py2exe 创建的 exe 给出错误

发布于 2024-08-27 17:41:46 字数 280 浏览 8 评论 0原文

我从 py2exe 创建了一个 exe。成功创建exe后,当我运行main.exe时出现以下错误。

  File "_mssql.pyc", line 12, in <module>
  File "_mssql.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

我正在为 sql server 使用 pymssql 模块。

i have created an exe from py2exe. After successfully creating the exe, i got the following error when i run main.exe.

  File "_mssql.pyc", line 12, in <module>
  File "_mssql.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

I am using pymssql module for sql server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

思慕 2024-09-03 17:41:46

确保将该模块包含在 options 字典下。我认为它还需要一个名为 ntwdblib.dll 的 dll 文件。您可以找到该文件并将其包含到您的 setup.py 中。

import os, pymssql
from distutils.core import setup
import py2exe
dll = []
dll.append(os.path.join(os.path.split(pymssql.__file__)[0], 'ntwdblib.dll'))
pyops = {"includes": ['decimal']}
setup(console=['app.py'], options={"py2exe": pyops}, data_files=dll)

make sure you include the module under the options dictionary. I think it also needs a dll file called ntwdblib.dll. you can find that file and include it into your setup.py.

import os, pymssql
from distutils.core import setup
import py2exe
dll = []
dll.append(os.path.join(os.path.split(pymssql.__file__)[0], 'ntwdblib.dll'))
pyops = {"includes": ['decimal']}
setup(console=['app.py'], options={"py2exe": pyops}, data_files=dll)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文