gpt4 book ai didi

python - pandas导入时exe文件运行失败

转载 作者:太空宇宙 更新时间:2023-11-03 20:30:40 28 4
gpt4 key购买 nike

exe 文件启动但崩溃并显示 ModuleNotFoundError: No module named 'numpy.random.common'

我使用pyinstaller --onefile hello.py --hidden-import pandas和.exe 文件失败。我尝试通过添加路径来更改规范文件 pandas,但是.exe文件仍然失败。

hello.py文件的内容:

import os
input("before loading pandas")
import pandas
print ("hello")
input('waiting for keyboard input')

规范文件的内容:

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

def get_pandas_path():
import pandas
pandas_path=pandas.__path__[0]
return pandas_path


a = Analysis(['CreateExcelSAList.py'],
pathex=['D:\\OneDrive - Ardovlam NV\\15. Python\\hello'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
dict_tree=Tree(get_pandas_path(),prefix='pandas',excludes=["*.pyc"])
a.datas+=dict_tree
a.binaries=filter(lambda x:'pandas' not in x[0], a.binaries)

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='hello',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
scoll=COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='hello')

最佳答案

似乎是一个已知错误。请查看:https://github.com/numpy/numpy/issues/14163 。 stackoverflow上有引用解决方案。

关于python - pandas导入时exe文件运行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57535602/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com