No module named blake2b
No module named ‘blake2b’
import blake2b
ModuleNotFoundError: No module named 'blake2b'
安装
pip install pyblake2
遇到的问题:
(yolo) D:\Desktop\XLWD\demo\Picocrypt-main\src>pip install pyblake2
Collecting pyblake2Downloading pyblake2-1.1.2.tar.gz (126 kB)Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyblake2Building wheel for pyblake2 (setup.py) ... errorerror: subprocess-exited-with-error× python setup.py bdist_wheel did not run successfully.│ exit code: 1╰─> [11 lines of output]running bdist_wheelrunning buildrunning build_extbuilding 'pyblake2' extensioncreating buildcreating build\temp.win-amd64-cpython-39creating build\temp.win-amd64-cpython-39\Release"D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBLAKE2_COMPRESS_AUTO=1 -ID:\anaconda3\envs\yolo\include -ID:\anaconda3\envs\yolo\Include "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" /Tcblake2b_impl.c /Fobuild\temp.win-amd64-cpython-39\Release\blake2b_impl.objblake2b_impl.cF:\UserData\TEMP\pip-install-okksecr7\pyblake2_52a8bcd27cc34d3eb5bf49c901f66dfb\impl/blake2b-ref.c(16): fatal error C1083: 无法打开包括文件: “string.h”: No such file or directoryerror: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for pyblake2Running setup.py clean for pyblake2
Failed to build pyblake2
ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyblake2)
问题分析:
从错误信息来看,安装pyblake2时出现了编译错误,主要原因是缺少 C 语言标准库头文件(string.h),这通常与 Visual Studio 的安装不完整有关。
解决方案
-
打开已安装的Visual Studio 2019
-
进入 “工具” → “获取工具和功能”
-
在安装界面中,确保勾选以下组件:
Desktop development with C++(桌面开发 C++)
展开该选项,确保勾选Windows 10 SDK(或对应系统版本的 SDK)
勾选MSVC v142 - VS 2019 C++ x64/x86 build tools -
点击 “修改” 完成安装,然后重启电脑后再尝试安装:
pip install pyblake2