pip install pycrypto
使用 python3.5.2 工作正常,但使用 python3.6 失败,出现以下错误:
inttypes.h(26):错误 C2061:语法错误:标识符“intmax_t”
pip install pycrypto
使用 python3.5.2 工作正常,但使用 python3.6 失败,出现以下错误:
inttypes.h(26):错误 C2061:语法错误:标识符“intmax_t”
Python 安装目录中的文件 include\pyport.h 不再有#include < stdint.h >。这使intmax_t未定义。
Microsoft VC 编译器的一种解决方法是通过 OS 环境变量CL强制包含stdint.h:
感谢user1960422的回答。
pycrypto 2.6.1(通过 simple-crypt)/Python 3.6/Windows 10 的 PowerShell 步骤:
$env:VCINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
$env:CL="-FI`"$env:VCINSTALLDIR\INCLUDE\stdint.h`""
成功的 simple-crypt / pycrypto 安装
我还需要遵循以下答案:https ://stackoverflow.com/a/24822876/8751739来修复winrandom
模块错误。
卸载当前的 Python 版本
为 amd64 架构安装 Python
遵循其他公认的解决方案:
set CL=-FI"%VCINSTALLDIR%Tools\MSVC\14.11.25503\include\stdint.h"
pip install pycrypto
对于遇到与我相同情况的人:
环境
脚步
set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\stdint.h"
pip install pycrypto
(可能需要管理员权限)对我来说,这解决了它:
使用 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
为我修复它!