我是在win11, python3.6基础上安装pycrypto报错的,使用的安装命令为: 'pip install pycrypto' 。

 D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Isrc/ -Isrc/inc-msvc/ -Ic:\python368\include -Ic:\python368\include "-ID:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\ATLMFC\include" "-ID:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-ID:\Windows Kits\10\include\10.0.19041.0\ucrt" "-ID:\Windows Kits\10\\include\10.0.19041.0\\shared" "-ID:\Windows Kits\10\\include\10.0.19041.0\\um" "-ID:\Windows Kits\10\\include\10.0.19041.0\\winrt" "-ID:\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/winrand.c /Fobuild\temp.win32-3.6\Release\src/winrand.objwinrand.cD:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(31): error C2061: 语法错误: 标识符“intmax_t”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2061: 语法错误: 标识符“rem”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2059: 语法错误:“;”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(33): error C2059: 语法错误:“}”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2061: 语法错误: 标识符“imaxdiv_t”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2059: 语法错误:“;”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(45): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2061: 语法错误: 标识符“_Number”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2059: 语法错误:“;”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(47): error C2059: 语法错误:“)”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(50): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2061: 语法错误: 标识符“_Numerator”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: 语法错误:“;”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: 语法错误:“,”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(53): error C2059: 语法错误:“)”D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(55): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(61): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(68): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(74): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(81): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(87): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(94): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)error: command 'D:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2----------------------------------------
Command "c:\python368\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\cosseen\\AppData\\Local\\Temp\\pip-install-wjk8w2u4\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\cosseen\AppData\Local\Temp\pip-record-pk6psnb1\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\cosseen\AppData\Local\Temp\pip-install-wjk8w2u4\pycrypto\

解决办法:

1. 设置编译的环境,在native tools command基础上,再次运行vcvars*.bat。我本地的脚本为D:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\vsdevcmd\ext\vcvars.bat。运行时,最好输入绝对路径。

2. 添加CL参数set CL=-FI"Full-Path\stdint.h" (替换红色部分为自己的目录)

set CL=-FI"%VCINSTALLDIR%\INCLUDE\stdint.h"

也可以使用绝对路径

set CL=-FI"D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\stdint.h"

3. 再次执行安装命令,安装成功。

D:\Program Files\Microsoft Visual Studio\2022\Community>pip install pycrypto
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Collecting pycryptoDownloading http://mirrors.aliyun.com/pypi/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz (446kB)100% |████████████████████████████████| 450kB 14.6MB/s
Installing collected packages: pycryptoRunning setup.py install for pycrypto ... done
Successfully installed pycrypto-2.6.1

另外,最好使用PyCryptodome 代替pycrypto,pycrypto不再维护了,而PyCryptodome的API和

pycrypto的相同。

Python 3 - Install pycrypto on Windows相关推荐

  1. python 报错汇总-- pip install pycrypto

    python 报错汇总-- pip install pycrypto 很多新手和老鸟在安装pycrypto时候会报各种错, 废话不多说,直接上: 原因 我也报了文末的错说是VC14什么的,花了差不多三 ...

  2. Python加密工具包pycrypto的安装

    [介绍] pycrypto是用Python写的加密工具包. This is a collection of both secure hash functions (such as SHA256 and ...

  3. 解决 python pip install安装速度慢| 版本低|跨过个别错误包

    pip2 install keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 跨过个别错误包: pip批量安装跳 ...

  4. windows搭建python开发环境方法_04 Windows下搭建 Python 开发环境 - Python 入门教程

    前面两个小节中我们已经学习了在 MacOS 和 Ubuntu 中安装 Python 的开发环境.当然,作为用户基数最多的 Windows 操作系统,我们当然不会忘记,这节课我们就来学习下如何在 Win ...

  5. python pip、conda、windows CMD常用命令大全!

    文章目录 python pip 常用命令 1.查找软件 2.安装软件 3.更新软件 4.卸载软件 5.列出已安装软件 6.查看一个软件包时安装了哪些文件 7.命令补全 8.升级所有包 9.修改pip安 ...

  6. pip install pycrypto

    最近在搞微信小程序的订阅接口,发现用到这个模块pycrypto from Crypto.Cipher import AES 报错 于是我这样 pip install pycrypto 我2019-09 ...

  7. Python pip install 下载出错的解决办法

    Python pip install 下载出错的解决办法 在Windows操作系统下,为Python IDLE 编译器安装扩展程序库的步骤可以查看链接:Python pip install 指令的使用 ...

  8. python 打包成exe 1053_Python Windows服务pyinstaller可执行文件错误1053

    我在 python中编写了一个 Windows服务.如果我从命令提示符运行我的脚本 python runService.py 当我这样做时,服务安装并正确启动.我一直在尝试使用pyinstaller创 ...

  9. Anaconda3 下载安装及不同python环境配置(Linux/Windows)

    Anaconda3 下载安装及不同python环境配置(Linux/Windows) 一.Anaconda3安装 Windows Linux(以ubuntu18.04为例) 二.配置虚拟环境 一.An ...

最新文章

  1. 贴吧html标签,html标签3(转载)
  2. Django中HttpResponse和JsonResponse的区别和用法
  3. 6行代码解决golang TCP粘包
  4. obs可以推到中转服务器吗,[经验分享]OBS 如何实现多路推流
  5. .md是什么文件_Element-UI源码阅读之md显示到页面
  6. SQL SERVER 2014 各个版本支持的功能
  7. c#中的socket(tcp)
  8. eclipse中不能找到dubbo.xsd报错”cvc-complex-type.2.4.c“的 两种解决方法
  9. Android 系统 (131)---ODM 开发用户常见需求文档(五)
  10. 【TW短评测】6999元Find X2 Pro一周体验:这块120Hz屏我能玩一年
  11. 《程序员代码面试指南》第一章:栈与队列
  12. FlashFXP 破解版下载地址
  13. c语言数组回文数编写字符串,回文数C语言(示例代码)
  14. 浅谈CURD系统和CRQS系统
  15. Linux 管理面板云帮手、APPNODE与宝塔哪个好
  16. 新款智能枕头为人们的生活带来更佳体验
  17. Python使用Matplotlib绘制三维折线图(进阶篇)
  18. 如何用java读取并解析geojson文件
  19. Multiview Detection with Feature Perspective Transformation
  20. 打字标准 / 打字键位 / 打字速度提升

热门文章

  1. WinCE7.0 下 Silverlight(XAML) 类型的应用启动逻辑
  2. 如何使用Excel对一元一次或多次方程求解,单变量求解工具的 使用
  3. 阿里巴巴项目P8技术咖总结的Java心得,完整版PDF可下载
  4. 如何做到企业数据安全恢复
  5. adb与monkey命令的联合使用
  6. gradle的依赖方式优化
  7. Heritrix1.14.4安装配置和使用
  8. 电脑开机黑屏一串英文_电脑开机黑屏一串英文怎么办
  9. 计算机无法启动应用程序怎么办,应用程序无法正常启动,小编教你电脑应用程序无法正常启动0xc000007b怎么解决...
  10. Pytorch实现CenterLoss(实战)