Python - pysvn 在调用用 py2exe 编译的 exe 时出现 FileNotFoundError
Python - FileNotFoundError for pysvn in calling exe compiled with py2exe
setup.py 对于 py2exe:
setup(console=['TagProject.py'], options={'py2exe':{'dist_dir':'AriesTools'} } )
调用exe时报错:
Traceback (most recent call last):
File "TagProject.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "pysvn\__init__.pyc", line 116, in <module>
File "os.pyc", line 1111, in add_dll_directory
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'H:\PythonScripts\AriesTools\library.zip\pysvn'
已安装的组件:
Python 3.9.6 (32-bit)
Python 3.9 PySVN 1.9.13-2056 on Win32
py2exe-0.10.4.0-cp39-cp39-win32.whl
我使用相同的过程为其他不使用pysvn的脚本创建exe,但exe没有显示相同的问题。
附加信息,编译输出:
running py2exe
4 missing Modules
------------------
? UserDict imported from pysvn
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline imported from cmd, code, pdb
? resource imported from test.support
Building 'AriesTools\TagProject.exe'.
Building shared code archive 'AriesTools\library.zip'.
Copy c:\users\nobody\appdata\local\programs\python\python39-32\python39.dll to AriesTools
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\unicodedata.pyd to AriesTools\unicodedata.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\select.pyd to AriesTools\select.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_bz2.pyd to AriesTools\_bz2.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_lzma.pyd to AriesTools\_lzma.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\pyexpat.pyd to AriesTools\pyexpat.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_socket.pyd to AriesTools\_socket.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_hashlib.pyd to AriesTools\_hashlib.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_decimal.pyd to AriesTools\_decimal.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_ssl.pyd to AriesTools\_ssl.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_queue.pyd to AriesTools\_queue.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_elementtree.pyd to AriesTools\_elementtree.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_ctypes.pyd to AriesTools\_ctypes.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_tkinter.pyd to AriesTools\_tkinter.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_testinternalcapi.pyd to AriesTools\_testinternalcapi.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_testcapi.pyd to AriesTools\_testcapi.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_asyncio.pyd to AriesTools\_asyncio.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_multiprocessing.pyd to AriesTools\_multiprocessing.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_overlapped.pyd to AriesTools\_overlapped.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\_pysvn_3_9.pyd to AriesTools\pysvn._pysvn_3_9.pyd
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_client-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libapriconv-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_fs-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_diff-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libaprutil-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_util-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libapr-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\tk86t.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_x-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_wc-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libssl-1_1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_subr-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libffi-7.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_delta-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libcrypto-1_1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_repos-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_ra-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\tcl86t.dll to AriesTools\
Press any key to continue . . .
我通过删除 pysvn\__init__.py 文件中的以下语句解决了这个问题:
add_dll_handle = os.add_dll_directory( os.path.dirname( __file__ ) )
没有这条语句,pysvn 模块仍然可以正常工作。希望有人想出比这更好的解决方案。现在,我很擅长这个。
setup.py 对于 py2exe:
setup(console=['TagProject.py'], options={'py2exe':{'dist_dir':'AriesTools'} } )
调用exe时报错:
Traceback (most recent call last):
File "TagProject.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "pysvn\__init__.pyc", line 116, in <module>
File "os.pyc", line 1111, in add_dll_directory
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'H:\PythonScripts\AriesTools\library.zip\pysvn'
已安装的组件:
Python 3.9.6 (32-bit)
Python 3.9 PySVN 1.9.13-2056 on Win32
py2exe-0.10.4.0-cp39-cp39-win32.whl
我使用相同的过程为其他不使用pysvn的脚本创建exe,但exe没有显示相同的问题。
附加信息,编译输出:
running py2exe
4 missing Modules
------------------
? UserDict imported from pysvn
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline imported from cmd, code, pdb
? resource imported from test.support
Building 'AriesTools\TagProject.exe'.
Building shared code archive 'AriesTools\library.zip'.
Copy c:\users\nobody\appdata\local\programs\python\python39-32\python39.dll to AriesTools
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\unicodedata.pyd to AriesTools\unicodedata.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\select.pyd to AriesTools\select.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_bz2.pyd to AriesTools\_bz2.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_lzma.pyd to AriesTools\_lzma.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\pyexpat.pyd to AriesTools\pyexpat.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_socket.pyd to AriesTools\_socket.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_hashlib.pyd to AriesTools\_hashlib.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_decimal.pyd to AriesTools\_decimal.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_ssl.pyd to AriesTools\_ssl.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_queue.pyd to AriesTools\_queue.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_elementtree.pyd to AriesTools\_elementtree.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_ctypes.pyd to AriesTools\_ctypes.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_tkinter.pyd to AriesTools\_tkinter.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_testinternalcapi.pyd to AriesTools\_testinternalcapi.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_testcapi.pyd to AriesTools\_testcapi.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_asyncio.pyd to AriesTools\_asyncio.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_multiprocessing.pyd to AriesTools\_multiprocessing.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\_overlapped.pyd to AriesTools\_overlapped.pyd
Copy C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\_pysvn_3_9.pyd to AriesTools\pysvn._pysvn_3_9.pyd
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_client-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libapriconv-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_fs-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_diff-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libaprutil-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_util-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libapr-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\tk86t.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs_x-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_wc-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libssl-1_1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_subr-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libffi-7.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_delta-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\libcrypto-1_1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_fs-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_repos-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\Lib\site-packages\pysvn\libsvn_ra-1.dll to AriesTools\
Copy DLL C:\Users\nobody\AppData\Local\Programs\Python\Python39-32\DLLs\tcl86t.dll to AriesTools\
Press any key to continue . . .
我通过删除 pysvn\__init__.py 文件中的以下语句解决了这个问题:
add_dll_handle = os.add_dll_directory( os.path.dirname( __file__ ) )
没有这条语句,pysvn 模块仍然可以正常工作。希望有人想出比这更好的解决方案。现在,我很擅长这个。