无法加载 dynlib/dll
Failed to load dynlib/dll
我正在尝试使用 PyInstaller 将以下 Python 代码打包到可执行文件中:
import pandas as pd
import teradatasql
with teradatasql.connect(host='abcdxxx', user='abcdxxx', password='abcdxxx') as connect:
query = "SHOW TABLE AdventureWorksDW.DimAccount"
df = pd.read_sql(query, connect)
print(df)
当我 运行 .exe 文件时,它给我错误:
PyInstallerImportError: Failed to load dynlib/dll
'C:\Users\GAX~1.P\AppData\Local\Temp\_MEI153202\teradatasql\teradatasql.dll'.
Most likely this dynlib/dll was not found when the application was frozen.
[9924] Failed to execute script 'hello' due to unhandled exception!
我尝试对 .spec 文件进行以下更改:
b = [
('C:\Users\Path_to_Python\Python\Python310\Lib\site-
packages\teradatasql\teradatasql.dll', '.\teradatasql')
]
a = Analysis(['hello.py'],
pathex=[],
binaries=b,
datas=[] # , .....
)
但是并没有解决问题。如何解决这个问题?
我们提供了一篇文章,解释如何将 Python 的 Teradata SQL 驱动程序包含到 PyInstaller 打包的应用程序中:
https://support.teradata.com/community?id=community_blog&sys_id=c327eac51b1e9c103b00bbb1cd4bcb37
我正在尝试使用 PyInstaller 将以下 Python 代码打包到可执行文件中:
import pandas as pd
import teradatasql
with teradatasql.connect(host='abcdxxx', user='abcdxxx', password='abcdxxx') as connect:
query = "SHOW TABLE AdventureWorksDW.DimAccount"
df = pd.read_sql(query, connect)
print(df)
当我 运行 .exe 文件时,它给我错误:
PyInstallerImportError: Failed to load dynlib/dll
'C:\Users\GAX~1.P\AppData\Local\Temp\_MEI153202\teradatasql\teradatasql.dll'.
Most likely this dynlib/dll was not found when the application was frozen.
[9924] Failed to execute script 'hello' due to unhandled exception!
我尝试对 .spec 文件进行以下更改:
b = [
('C:\Users\Path_to_Python\Python\Python310\Lib\site-
packages\teradatasql\teradatasql.dll', '.\teradatasql')
]
a = Analysis(['hello.py'],
pathex=[],
binaries=b,
datas=[] # , .....
)
但是并没有解决问题。如何解决这个问题?
我们提供了一篇文章,解释如何将 Python 的 Teradata SQL 驱动程序包含到 PyInstaller 打包的应用程序中: https://support.teradata.com/community?id=community_blog&sys_id=c327eac51b1e9c103b00bbb1cd4bcb37