pyinstaller执行出现:No module named 'Crypto.Math' 和 WARNING: lib not found: tbb.dll dependency
1. 在使用pyinstaller打包代码成exe文件时,出现No module named 'Crypto.Math' 错误的原因应该是:现在名称换了。
解决方法是:
pip uninstall crypto
pip uninstall pycryptodome
pip install pycryptodome
2. lib not found的警告,没找到很好的解决方法,就是默默地下载了几个warning里面的dll文件放到对应路径下,然后就没该dll的warning了,下载不到的dll还是会出现warning。
注意的是:没有下载这些dll时,我打包的exe文件也没问题,可运行。
有warning的整个运行日志如下:
d16746 INFO: Loading module hook "hook-distutils.py"... 16747 INFO: Loading module hook "hook-encodings.py"... 16879 INFO: Loading module hook "hook-lib2to3.py"... 16882 INFO: Loading module hook "hook-numpy.core.py"... 16979 INFO: MKL libraries found when importing numpy. Adding MKL to binaries 16985 INFO: Loading module hook "hook-numpy.py"... 16987 INFO: Loading module hook "hook-pkg_resources.py"... 17753 INFO: Processing pre-safe import module hook win32com 18151 INFO: Excluding import '__main__' 18153 INFO: Removing import of __main__ from module pkg_resources 18154 INFO: Loading module hook "hook-pycparser.py"... 18330 INFO: Loading module hook "hook-pydoc.py"... 18331 INFO: Loading module hook "hook-pytest.py"... 19194 INFO: Loading module hook "hook-pythoncom.py"... 19915 INFO: Loading module hook "hook-pywintypes.py"... 20576 INFO: Loading module hook "hook-scipy.py"... 20579 INFO: Loading module hook "hook-setuptools.py"... 21490 INFO: Loading module hook "hook-sysconfig.py"... 21492 INFO: Loading module hook "hook-win32com.py"... 22177 INFO: Loading module hook "hook-xml.dom.domreg.py"... 22179 INFO: Loading module hook "hook-xml.etree.cElementTree.py"... 22179 INFO: Loading module hook "hook-xml.py"... 22209 INFO: Looking for ctypes DLLs 22260 INFO: Analyzing run-time hooks ... 22265 INFO: Including run-time hook 'pyi_rth_pkgres.py' 22267 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py' 22269 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' 22282 INFO: Looking for dynamic libraries 22348 WARNING: lib not found: tbb.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_tbb_thread.dll 22497 WARNING: lib not found: impi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_intelmpi_ilp64.dll 22631 WARNING: lib not found: mpich2mpi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_mpich2_ilp64.dll 22637 WARNING: lib not found: msmpi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_msmpi_lp64.dll 22880 WARNING: lib not found: pgf90rtl.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_pgi_thread.dll 22882 WARNING: lib not found: pgc14.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_pgi_thread.dll 22886 WARNING: lib not found: pgf90.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_pgi_thread.dll 22890 WARNING: lib not found: impi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_intelmpi_lp64.dll 22897 WARNING: lib not found: msmpi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_msmpi_ilp64.dll 23163 WARNING: lib not found: mpich2mpi.dll dependency of d:\program_files\anaconda3\Library\bin\mkl_blacs_mpich2_lp64.dll 23609 INFO: Looking for eggs 23610 INFO: Using Python library d:\program_files\anaconda3\python37.dll 23610 INFO: Found binding redirects: [] 23619 INFO: Warnings written to D:\Python_workspace\spyder_space\test_exe\build\test_exe_1\warn-test_exe_1.txt 23715 INFO: Graph cross-reference written to D:\Python_workspace\spyder_space\test_exe\build\test_exe_1\xref-test_exe_1.html 23747 INFO: checking PYZ 23748 INFO: Building PYZ because PYZ-00.toc is non existent 23748 INFO: Building PYZ (ZlibArchive) D:\Python_workspace\spyder_space\test_exe\build\test_exe_1\PYZ-00.pyz 25063 INFO: Building PYZ (ZlibArchive) D:\Python_workspace\spyder_space\test_exe\build\test_exe_1\PYZ-00.pyz completed successfully. 25082 INFO: checking PKG 25082 INFO: Building PKG because PKG-00.toc is non existent 25083 INFO: Building PKG (CArchive) PKG-00.pkg 94937 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 94942 INFO: Bootloader d:\program_files\anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe 94942 INFO: checking EXE 94943 INFO: Building EXE because EXE-00.toc is non existent 94943 INFO: Building EXE from EXE-00.toc 94944 INFO: Appending archive to EXE D:\Python_workspace\spyder_space\test_exe\dist\test_exe_1.exe 95118 INFO: Building EXE from EXE-00.toc completed successfully.
也有人说:从win10改到win7上打包,就没这些警告:https://blog.csdn.net/dodwind/article/details/83107378。
参考:
https://stackoverflow.com/questions/57713994/modulenotfounderror-no-module-named-crypto-math