我正在尝试将相对简单的程序转换为Windows可执行文件。虽然使用pyinstaller进行转换没有任何问题,但是在运行该程序时,我看到以下消息。
我已经尝试了python 3.7和3.8的不同版本以及32位和64位体系结构。但是,同样的问题仍然存在。
我的Python程序:
import dill
import time
r1 = "hello"
time.sleep(10)
filename = ".\globalsave.txt"
dill.dump_session(filename)
print(f'dump success')
运行Windows exec时出现错误(我正在使用Windows 10):
Traceback (most recent call last):
File "session1.py", line 13, in <module>
File "site-packages\dill\_dill.py", line 351, in dump_session
File "site-packages\dill\_dill.py", line 445, in dump
File "pickle.py", line 437, in dump
File "pickle.py", line 504, in save
File "site-packages\dill\_dill.py", line 1295, in save_module
File "pickle.py", line 662, in save_reduce
File "pickle.py", line 504, in save
File "site-packages\dill\_dill.py", line 912, in save_module_dict
File "pickle.py", line 859, in save_dict
File "pickle.py", line 885, in _batch_setitems
File "pickle.py", line 504, in save
File "site-packages\dill\_dill.py", line 1341, in save_type
File "pickle.py", line 638, in save_reduce
File "pickle.py", line 504, in save
File "pickle.py", line 789, in save_tuple
File "pickle.py", line 504, in save
File "pickle.py", line 774, in save_tuple
File "pickle.py", line 504, in save
File "site-packages\dill\_dill.py", line 1356, in save_type
File "pickle.py", line 965, in save_global
_pickle.PicklingError: Can't pickle <class 'ctypes.CDLL'>: it's not the same object as ctypes.CDLL
也尝试更改莳萝的版本,但错误仍然存在。