Windows安装pycrypto失败记录

Windows 10家庭中文版,Python 3.6.4,

180824测试前端加密文本在后台揭秘,查询后发现,可以使用pycrypto模块实现,那么,安装它(pip),结果安装失败了。

本文暂时记录下失败的日志,后面找到解决问题了再完善博文。

pycrypto相关网址:

PyPI:https://pypi.org/project/pycrypto/

官网:https://www.dlitz.net/software/pycrypto/

官文:https://www.dlitz.net/software/pycrypto/api/current/

使用pip list,没有找到pycrypto,那么,安装它。

>pip3 install pycrypto

下面是安装过程日志中的部分错误信息:

...

Running setup.py bdist_wheel for pycrypto ... error
Complete output from command c:\python36\python3.exe -u -c "import setuptools, tokenize;__file__=‘C:\\Users\\log\\AppData\\Local\\Temp\\pip-install-0e9wj35t\\pycrypto\\setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" bdist_wheel -d C:\Users\log\AppData\Local\Temp\pip-wheel-i1adunc1 --python-tag cp36:
...
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
...
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.6\Release\src/winrand.obj
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26): error C2061: syntax error: identifier ‘intmax_t‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2061: syntax error: identifier ‘rem‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2059: syntax error: ‘;‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28): error C2059: syntax error: ‘}‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2061: syntax error: identifier ‘imaxdiv_t‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2059: syntax error: ‘;‘
...
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(95): error C2143: syntax error: missing ‘{‘ before ‘__cdecl‘
error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe‘ failed with exit status 2
...
----------------------------------------
Failed building wheel for pycrypto
Running setup.py clean for pycrypto
Failed to build pycrypto
Installing collected packages: pycrypto
Running setup.py install for pycrypto ... error
Complete output from command c:\python36\python3.exe -u -c "import setuptools, tokenize;__file__=‘C:\\Users\\log\\AppData\\Local\\Temp\\pip-install-0e9wj35t\\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\log\AppData\Local\Temp\pip-record-ux9dvuso\install-record.txt --single-version-externally-managed --compile:
running install
...
build\lib.win-amd64-3.6\Crypto\Signature
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building ‘Crypto.Random.OSRNG.winrandom‘ extension
...
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.6\Release\src/winrand.obj
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26): error C2061: syntax error: identifier ‘intmax_t‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2061: syntax error: identifier ‘rem‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2059: syntax error: ‘;‘
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28): error C2059: syntax error: ‘}‘
...
----------------------------------------
Command "c:\python36\python3.exe -u -c "import setuptools, tokenize;__file__=‘C:\\Users\\log\\AppData\\Local\\Temp\\pip-install-0e9wj35t\\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\log\AppData\Local\Temp\pip-record-ux9dvuso\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\log\AppData\Local\Temp\pip-install-0e9wj35t\pycrypto\
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

----END----

从上面的错误日志来看,需要用到一个cl.exe命令,这个命令的路径存在于Microsoft Visual Studio 14.0或Windows Kits中,但是,孤的电脑上是没有的。

解决的方法当然是安装Microsoft Visual Studio,参考链接的解决方法也是说要安装一个,不过更详细一些。

另外,错误日志还提示GMP or MPIR library缺失,是否安装好Microsoft Visual Studio就有了呢?然后,之后就可以安装pycrypto了。

接下来,分为两步解决这个问题:

1.安装Microsoft Visual Studio;

2.安装pycrypto(此步骤的日志可以检查GMP or MPIR library是否已经有了,若是没有,且pycrypto安装失败,那么再找办法);

0825-0900新发现:

孤的电脑已经有错误日志中提到的Microsoft Visual Studio 14.0或Windows Kits目录及相关文件了,可是看来,上面说的解决方法是不对的,还需要继续dig才是

操作系统模块安装了Visual Studio 2015的部分功能吗?下图的这些是怎么来的呢?

既然如此,那么,又要怎么解决呢?再看看参考链接吧!

去Visual Studio官网看了一遍,好多软件,不愧是Microsoft!对于一位非Windows系程序员,要选对软件有些困难啊!

还要找找,到底Windows 10上能否安装pycrypto!

哎呀,都要耗费精时啊!

检查Python标准库,居然没有找到加密、安全相关的模块,搜索security、crypto都没有找到想要的——使用各种加密算法,看来,必须要用第三方库了,比如pycrypto。

参考链接:

windows 下的python 安装pycrypto by 园友 anne的夏天

python 加密解密 by 园友 jihite

0825-0930更新:哇哦,Ubuntu(18.04)上安装pycrypto好方便啊!嗖的一下就安装好勒!

安装好了,可是,import pycrypto失败!

>>> import pycrypto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named ‘pycrypto‘

疑问:怎么找到一个模块的用法呢?官网吗?通过模块本身可以知道吗?

参考下面的链接(官文)可以初步知道pycrypto模块的用法:

Python Cryptography Toolkit

原文地址:https://www.cnblogs.com/luo630/p/9532924.html

时间: 2024-08-03 19:49:19

Windows安装pycrypto失败记录的相关文章

windows安装pycrypto报错

在Windows上安装的时候直接 pip install pycrypto会报错 由于直接安装安装Crypto模块 会报错如下:因此需要先安装Microsoft Visual C++ 9.0 进入下载网址:https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266,直接下载后点击安装 下载的软件是VCForPython27.msi,安装好后,pip install pycrypto 原文地址:https://www.cn

windows安装fis-sass失败

最近在使用fis3, 团队遇到各种安装问题, 归纳如下: 1. 先确保安装了vs2015 community, https://www.visualstudio.com/downloads/download-visual-studio-vs 2. 安装python 3. 在"电脑管家"选择"电脑诊所" -> "腾讯专区" -> "剑灵崩溃", 解决一下就行了

windows安装mariaDB失败,服务不能启动

过年了,在老家闲余时间想敲敲代码,发现在安装mariaDb的时候一直报错错误信息:Service 'MySQL' (MySQL) Faild to start,Verify that you have suffcient privileges to start system services.服务的MySQL(MySQL)启动错误,确认你有权限启动系统服务.记得多年前在使用sql server 数据库的时候也遇到过同样的问题.1.首先不能关闭安装窗口,然后在计算机管理的服务右键MySQL,点击属

Windows 10安装DockerToolBox失败处理方法

指令运行报错: Windows 10安装DockerToolBox失败处理方法:升级Windows 10. (注意:只有Windows10 专业版才支持升级,Server和企业版无效) 原文地址:https://www.cnblogs.com/boonya/p/9531266.html

Windows 2008 R2 64位上安装wamp失败的原因

Exception Exception in module wampmanager.exe at 000F15A0... 因测试PHP程序需要,需要在windows系统上布署WAMP环境测试程序,对性能不作具体要求,选择WAMP Server进行快速布置. 系统环境:Windows 2008 R2 安装环境:WAMPSERVER 2.2D (64 BITS) 按照正常windows安装程序,完成WAMP Server程序安装,安装完成后,选择启动WAMP Server,但是出现 Exceptio

Win7 windows update更新失败 正在还原 无法开机 双系统下的解决方案

系统环境:win7 + Ubuntu 12.04 双系统 解决时间:2014年12月1日 前提: 反复强行关机后开机仍显示“windows update更新失败 正在还原” 开机高级选项菜单选择“安全模式”,安全模式也显示“windows update更新失败 正在还原” 开机高级选项菜单选择“最近一次的正确配置”,之后还是显示“windows update更新失败 正在还原” 手头无安装盘,又嫌U盘做启动盘太麻烦 1.开机,进入ubuntu系统(linux的文件系统是可以识别windows系统

Ubuntu下安装virtualbox失败解决方案

毕业设计用到了OpenGL,由于不会用MFC和Win32API做窗口程序:自然选用了GLUT.GLUT很好用,就是每次写一堆Init,注册callback,觉得有点恶心,于是对他做了简单的OO封装.记录在此,如有同学有兴趣可以下载. GLUT应用程序 直接使用GLUT的程序是这样的: #include <GL/glut.h> #include <stdio.h> void display() { // OpenGL commands } // 一般按键(所有可打印字符,ESC也在内

Python3.4 安装 pycrypto 提示错误的处理办法

今天做接口测试,有个接口的参数使用了 AES 加密,开发也提供了加密函数的实现,但是 Python2.6 实现的,我习惯使用的是 Python3.4,于是准备做下兼容处理,结果过程中发现安装 pycrypto 库会报错. 作为测试,定位问题并解决问题乃是我们的强项,于是花了点时间把问题处理了,顺便把解决的结果做个记录,如果后面有同学碰到同样的问题,也不用重复踩坑了. 先看看我安装库用的命令行: python34 -m pip install pycrypto 下面是报错信息: running b

win10安装inventor失败,怎么强力卸载删除注册表并重新安装

一些搞设计的朋友在win10系统下安装inventor失败或提示已安装,也有时候想重新安装inventor的时候会出现本电脑windows系统已安装inventor,你要是不留意直接安装inventor,只会安装inventor的附件或者直接提示失败,inventor是不会安装上的.这种原因就是大家在之前卸载inventor时没有把inventor残留注册表信息删除或者是因为C++版本不对,下面我来教大家如何把inventor强力卸载掉然后重新安装,最后完美安装运行inventor.如果纯手工删