python27.dll放入后无效_加载pyinstaller时出错python27.dll错误

I have successfully edited my spec file and added the folder with my data to it. It builds fine but it still can't access the data. WHen i try to run the compiled .exe i get this error: Error loading Python DLL: C:\Users\Sal\AppData\Local\Temp\_MEI60122\python27.dll (error code 126)

EDIT 1 - I still don't have this figured out my spec file looks like this:

a = Analysis(['Clock_In.py'],

pathex=['C:\\Users\\Sal\\Desktop'],

hiddenimports=[],

hookspath=None,

runtime_hooks=None)

a.datas += [('CO_time.pkl','CO_time.pkl', 'DATA')]

a.datas += [('hours.pkl','hours.pkl', 'DATA')]

a.datas += [('Obj_file.pkl','Obj_file.pkl', 'DATA')]

a.datas += [('weekly_hours_dict.pkl','weekly_hours_dict.pkl', 'DATA')]

pyz = PYZ(a.pure)

exe = EXE(pyz,

a.datas,

a.binaries,

a.scripts,

exclude_binaries=True,

name='Clock_In.exe',

debug=False,

strip=None,

upx=True,

console=True,

icon="C:\Users\Sal\Desktop\Raindropmemory-Legendora-BrokenSword.ico")

coll = COLLECT(exe,

a.binaries,

a.zipfiles,

a.datas,

strip=None,

upx=True,

**name='Clock_In')

EDIT 2

I am using 32-Bit python on a 64-bit OS(windows 8) and it has been brought to my attention that this could potentially be causing my issue, but still no solution.

EDIT 3

So i have just tried download 64-bit python and putting it in my system path. ran pyinstaller with my .spec file and still got the exact same error code! What is going on here! A curious detail though is that the icon="C:\Users\Sal\Desktop\Raindropmemory-Legendora-BrokenSword.ico") statement from spec file executed and updated the icon successfully, where as before it would not.

EDIT 4

This is the statement i have in my code for MEIPASS straight from the documentation.

if getattr(sys, 'frozen', False):

# we are running in a |PyInstaller| bundle

basedir = sys._MEIPASS

else:

# we are running in a normal Python environment

basedir = os.path.dirname(__file__)

解决方案

You put that code snippet right at the top of the Python script you are turning into an executable - not in the spec and not in its own script. I found an example here:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值