pip install pycrypto
可以在 Python3.5.2 上正常工作,但在 Python3.6 上会出现以下错误:
inttypes.h(26): error C2061: 语法错误: 标识符 'intmax_t'
pip install pycrypto
可以在 Python3.5.2 上正常工作,但在 Python3.6 上会出现以下错误:
inttypes.h(26): error C2061: 语法错误: 标识符 'intmax_t'
感谢user1960422的回答。
以下是在PowerShell下为pycrypto 2.6.1(通过simple-crypt)/ Python 3.6 / Windows 10执行的步骤:
$env:VCINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
$env:CL="-FI`"$env:VCINSTALLDIR\INCLUDE\stdint.h`""
我还需要按照答案:https://dev59.com/hGAf5IYBdhLWcg3wUBJc#24822876来修复winrandom
模块错误。
对于遇到与我相同情况的人:
环境
步骤
set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\stdint.h"
pip install pycrypto
(可能需要管理员权限)set CL=-FI"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\stdint.h"
- undefined卸载当前的Python版本
安装适用于amd64架构的Python
按照其他被接受的解决方案进行操作:
set CL=-FI"%VCINSTALLDIR%Tools\MSVC\14.11.25503\include\stdint.h"
pip install pycrypto
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build>vcvars64.bat
** Visual Studio 2019 开发人员命令提示符 v16.11.14 ** 版权所有 (c) 2021 Microsoft Corporation ********************************************************************** [vcvarsall.bat] 环境已初始化: 'x86_x64'
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\stdint.h"
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>pip install pycrypto 正在收集 pycrypto 使用缓存 pycrypto-2.6.1.tar.gz (446 kB) 正在准备元数据 (setup.py) ... 完成 已收集 pycrypto 的 wheel 包: - pycrypto-2.6.1-cp39-cp39-win_amd64.whl 正在构建 wheel for pycrypto (setup.py) ... 完成 已创建 wheel for pycrypto: 文件名=pycrypto-2.6.1-cp39-cp39-win_amd64.whl 大小=528832 sha256=250926fc0e06b4c1ed9c2fb16ad9b4723984ef68c1e5383b26c974235536a0ae 已存储于目录: c:\users\volka\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local\pip\cache\wheels\9d\29\32\8b8f22481bec8b0fbe7087927336ec167faff2ed9db849448f 成功构建 pycrypto wheel 包 安装已收集的包: pycrypto 成功安装 pycrypto-2.6.1
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>
对我来说,这样修复了它:
使用Python 2,我有
sudo apt-get install python-dev \
build-essential libssl-dev libffi-dev \
libxml2-dev libxslt1-dev zlib1g-dev \
...
使用Python 3,我需要
sudo apt-get install python3 python-dev python3-dev \
build-essential libssl-dev libffi-dev \
...
对于我来说,安装python-dev python3-dev
就解决了这个问题!
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
。 - CMCDragonkaistdint.h
,我已经在该错误报告中添加了所需修复的说明。 - Paul Mooreset CL=-FI"%VCINSTALLDIR%\include\stdint.h"
。 - Stefan