ModuleNotFoundError:没有名为“Crypto.Math”的模块

2023-12-03

在 Windows 上,我想运行pyinstaller myapp.py -w -f但我对加密模块有一些错误。

在我的代码中,我使用 4 个导入,这 4 个导入中的每一个(独立)都会给我同样的错误

from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import browser_cookie3

我尝试了在 Google 和 Stackoverflow 上找到的一些东西:

pip install pycryptodome
pip install pycryptodomex
pip install pycrypto
pip install pycrypto --upgrade

这是由这些行触发的 pyinstaller 错误(每一行都会触发错误):

ModuleNotFoundError:没有名为“Crypto.Math”的模块

(base) C:\Users\User1\.spyder-py3>pyinstaller temp.py --clean --noconsole --onefile
108 INFO: PyInstaller: 3.5
108 INFO: Python: 3.7.3
109 INFO: Platform: Windows-10-10.0.18362-SP0
110 INFO: wrote C:\Users\User1\.spyder-py3\temp.spec
112 INFO: UPX is not available.
113 INFO: Removing temporary files and cleaning cache in C:\Users\User1\AppData\Roaming\pyinstaller
275 INFO: Extending PYTHONPATH with paths
['C:\\Users\\User1\\.spyder-py3', 'C:\\Users\\User1\\.spyder-py3']
276 INFO: checking Analysis
278 INFO: Building Analysis because Analysis-00.toc is non existent
280 INFO: Initializing module dependency graph...
295 INFO: Initializing module graph hooks...
299 INFO: Analyzing base_library.zip ...
9372 INFO: running Analysis Analysis-00.toc
9404 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\User1\anaconda3\python.exe
9956 INFO: Caching module hooks...
9966 INFO: Analyzing C:\Users\User1\.spyder-py3\temp.py
10250 INFO: Processing pre-safe import module hook   six.moves
18166 INFO: Processing pre-find module path hook   distutils
18581 INFO: Processing pre-find module path hook   site
18582 INFO: site: retargeting to fake-dir 'c:\\users\\User1\\anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
23353 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
40091 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
46752 INFO: Loading module hooks...
46753 INFO: Loading module hook "hook-certifi.py"...
46759 INFO: Loading module hook "hook-Crypto.py"...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'Crypto.Math'
46884 INFO: Loading module hook "hook-cryptography.py"...
47419 INFO: Loading module hook "hook-distutils.py"...
47422 INFO: Loading module hook "hook-encodings.py"...
47585 INFO: Loading module hook "hook-httplib2.py"...
47589 INFO: Loading module hook "hook-keyring.backends.py"...
47709 INFO: Loading KWallet
47712 INFO: Loading SecretService
47715 INFO: Loading Windows
47717 INFO: Loading chainer
47718 INFO: Loading macOS
47913 INFO: Loading module hook "hook-lib2to3.py"...
47919 INFO: Loading module hook "hook-pkg_resources.py"...
49245 INFO: Processing pre-safe import module hook   win32com
50003 INFO: Loading module hook "hook-pycparser.py"...
50004 INFO: Loading module hook "hook-pydoc.py"...
50006 INFO: Loading module hook "hook-pythoncom.py"...
51079 INFO: Loading module hook "hook-pywintypes.py"...
52124 INFO: Loading module hook "hook-setuptools.py"...
66447 INFO: Loading module hook "hook-sqlite3.py"...
66594 INFO: Loading module hook "hook-sysconfig.py"...
66596 INFO: Loading module hook "hook-win32com.py"...
67931 INFO: Loading module hook "hook-xml.dom.domreg.py"...
67932 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
67934 INFO: Loading module hook "hook-xml.py"...
67937 INFO: Loading module hook "hook-importlib_metadata.py"...
67940 INFO: Loading module hook "hook-numpy.core.py"...
68078 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
68085 INFO: Loading module hook "hook-numpy.py"...
68087 INFO: Loading module hook "hook-pytest.py"...
70238 INFO: Loading module hook "hook-scipy.py"...
70347 INFO: Looking for ctypes DLLs
70502 INFO: Analyzing run-time hooks ...
70522 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
70527 INFO: Including run-time hook 'pyi_rth_pkgres.py'
70529 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
70533 INFO: Including run-time hook 'pyi_rth_certifi.py'
70567 INFO: Looking for dynamic libraries
70682 WARNING: lib not found: tbb.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_tbb_thread.dll
70738 WARNING: lib not found: msmpi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_msmpi_lp64.dll
70854 WARNING: lib not found: pgf90rtl.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_pgi_thread.dll
70905 WARNING: lib not found: pgf90.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_pgi_thread.dll
70953 WARNING: lib not found: pgc14.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_pgi_thread.dll
71133 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_mpich2_lp64.dll
71258 WARNING: lib not found: impi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_intelmpi_ilp64.dll
71480 WARNING: lib not found: msmpi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_msmpi_ilp64.dll
71837 WARNING: lib not found: impi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_intelmpi_lp64.dll
71928 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\User1\anaconda3\Library\bin\mkl_blacs_mpich2_ilp64.dll
72982 INFO: Looking for eggs
72982 INFO: Using Python library c:\users\User1\anaconda3\python37.dll
72986 INFO: Found binding redirects:
[]
73008 INFO: Warnings written to C:\Users\User1\.spyder-py3\build\temp\warn-temp.txt
73333 INFO: Graph cross-reference written to C:\Users\User1\.spyder-py3\build\temp\xref-temp.html
73395 INFO: checking PYZ
73395 INFO: Building PYZ because PYZ-00.toc is non existent
73398 INFO: Building PYZ (ZlibArchive) C:\Users\User1\.spyder-py3\build\temp\PYZ-00.pyz
77077 INFO: Building PYZ (ZlibArchive) C:\Users\User1\.spyder-py3\build\temp\PYZ-00.pyz completed successfully.
77143 INFO: checking PKG
77143 INFO: Building PKG because PKG-00.toc is non existent
77143 INFO: Building PKG (CArchive) PKG-00.pkg
207908 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
218323 INFO: Bootloader c:\users\User1\anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
218323 INFO: checking EXE
218324 INFO: Building EXE because EXE-00.toc is non existent
218324 INFO: Building EXE from EXE-00.toc
218353 INFO: Appending archive to EXE C:\Users\User1\.spyder-py3\dist\temp.exe
218611 INFO: Building EXE from EXE-00.toc completed successfully.

解决方法:将 Math 从 Cryptodome 文件夹复制到 Crypto 文件夹,不再出现错误...


Windows 中存在冲突是因为系统不区分大小写。你可以查看官方的解释pycryptodome 常见问题解答.

建议卸载并重新安装:

pip uninstall crypto
pip uninstall pycryptodome
pip install pycryptodome

对于 Conda,这对我有用:

conda install pycryptodome
conda uninstall crypto
conda install pyinstaller
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ModuleNotFoundError:没有名为“Crypto.Math”的模块 的相关文章

随机推荐

  • 检查机器中安装的模块列表

    我制作了一个脚本来告知管理员需要在计算机上安装的模块列表 我正在尝试检查模块是否通过下面的代码安装 奇怪的是 它显示机器中已安装的模块为not installed usr bin perl w my module list Smart Co
  • 如何使用带有预填充数据库的房间持久性库?

    我想将 Room 与预填充的数据库一起使用 但我不明白如何告诉 Room 在哪里可以找到我的数据库 我现在已经把它放进去了src main assets databases当我为 Room 数据库创建实例时 我这样创建 Room datab
  • Android:从资产文件夹复制数据库 (Sqliite) 时出错

    我在 SQLite 浏览器中设计了数据库 现在我正在尝试将其复制到我的根路径 面临的问题 复制数据库时出错 LINK 我从这个例子中得到帮助 将外部 Sqlite Db 添加到应用程序的链接 我的 DBhelper 类 package co
  • 在 Python multiprocessing.Pool 中共享可变全局变量

    我正在尝试更新共享对象 dict 使用以下代码 但这不起作用 它给了我输入dict作为输出 Edit Exxentially 我在这里想要实现的是将数据 列表 中的项目附加到字典的列表中 数据项给出字典中的索引 预期产出 2 2 1 1 4
  • MAMP PRO 崩溃; MySQL 不会在重启时启动

    今天上班时 我的电脑突然死机 崩溃了 重新启动时 MAMP 拒绝启动 mysql 我不明白为什么 肯定没有其他mysql进程在运行 我已经检查过好几次了 所以killall 9 mysqld不是解决方案 实际上我也完全重新安装了 MAMP
  • twitter4j 未发现身份验证挑战

    几天来一直尝试使用 twitter4j 发布推文 但没有运气 我想做的是让一个人在一轮结束时从应用程序的时间轴上发布他们的新最高分 这是我的代码 Override protected void onCreate Bundle savedIn
  • pandas.read_parquet 错误地解释了日期字段

    我有一个镶木地板文件 其中有一个日期字段 名为 BusinessDate 当我将其导入数据框时 它会自动确定字段 BusinessDate 是日期 datetime64 ns UTC 然而 由于这种格式 BusinessDate 场是 YY
  • 有没有办法在textview中显示HTML内容?

    我尝试了 iPhone Cookbook 中的以下一项 我通过访问 UITextview 的私有 API 显示 HTML 内容 例如 interface UITextView extended void setContentToHTMLSt
  • 用 python 抓取表格

    我正在尝试抓取表格并将其转换为 python 中的 data tables 但我在美国的选举数据方面运气不佳 这是我想要抓取的数据的 html tr class type republican th class results name a
  • 拆分字符串并将区域设置应用于 Pandas Series 的每一行

    我想对amount以下 df 的列 Address type amount 0 0x88aDa02f6fCE2F1A833cd9B4999D62a7ebb70367 outflow 250 000 VSO 1 0x88aDa02f6fCE2
  • 在nextjs中查看页面源不显示页面

    由于 SEO 我将项目从 CRA 转移到了 nextjs 在服务器端渲染时 客户端会获得完整的 HTML 页面作为响应 但在我的情况下 当我查看登陆页面的页面源时 我只会看到 div div div div 在每个页面上 页面源显示相同 这
  • 对 vtable 的未定义引用...

    我正在尝试编写一个 Http 代理 其工作原理基本上如下印度网络代理 所以我启动了 qtcreator 但我的一个类无法编译并出现臭名昭著的错误 undefined reference to vtable for HttpProxyThre
  • 查找一组日期范围中的空白的好方法是什么?

    查找一组日期范围中的空白的方法是什么 例如 我有这些日期范围 1 1 11 1 10 11 1 13 11 1 15 11 1 20 11 1 30 11 然后我的开始日期和结束日期分别为 2011 年 1 月 7 日和 2011 年 1
  • Android 相机2 API。设置多个 ImageReader 表面会产生空白输出

    我有一个camera2实现 当前的设置是 它使用纹理视图表面来显示实际的相机视图和ImageReader用于捕捉图像的表面 现在我也想捕获预览帧 所以我尝试添加一个新的ImageReader用于捕获帧的表面 但是当我将该表面添加到creat
  • ActionBar 中 SearchView 的主题

    我有一个SearchView in an ActionBar This SearchView图标是黑色的 文本也是黑色的 而我的图标是白色的 menu menu
  • 如何检测 Chrome 扩展程序中的网络状态变化

    我正在编写一个简单的 Chrome 扩展 需要该行为来检测设备是否连接到互联网 我目前正在尝试连接到 ping 服务来检查网络状态 但效率不高 我可以从 Chrome JavaScript API 监听任何事件吗 中没有具体事件Chrome
  • 写入操作期间发生磁盘错误。 (HRESULT 异常:0x8003001D (STG_E_WRITEFAULT))

    我正在使用 EPPlus 读取 vb net 中的 csv 文件 当我运行此代码时 出现错误 写入操作期间发生磁盘错误 HRESULT 异常 0x8003001D STG E WRITEFAULT 这是我的代码 Public Functio
  • 尝试让 QProcess 使用队列

    我正在尝试使用队列运行多个进程 并使用以下命令获取所有进程的输出QProcess但我有几个问题 我正在使用一个QSpinBox设置同时运行的最大进程数 我可以让主线程中的一切正常工作 或者如果我使用进程中的进程运行循环QObject但我无法
  • XML 规范是否定义在自闭斜杠之前有空格是非法的?

    我说的是 XML 文档而不是 HTML 由于在 HTML 中 br and br 都是有效的 想知道 XML 规范是否定义了自闭斜杠之前是否允许有空格 我刚刚遇到一个奇怪的问题
  • ModuleNotFoundError:没有名为“Crypto.Math”的模块

    在 Windows 上 我想运行pyinstaller myapp py w f但我对加密模块有一些错误 在我的代码中 我使用 4 个导入 这 4 个导入中的每一个 独立 都会给我同样的错误 from googleapiclient dis