windows安装pycrypto出现cl.exe' failed with exit status 2

windows安装pycrypto出现cl.exe' failed with exit status 2

安装参考

https://blog.csdn.net/a624806998/article/details/78596543

问题记录

src/libtom/tomcrypt_cfg.h(26): warning C4273: 'malloc': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_malloc.h(97): note: see previous definition of 'malloc'
src/libtom/tomcrypt_cfg.h(27): warning C4273: 'realloc': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_malloc.h(116): note: see previous definition of 'realloc'
src/libtom/tomcrypt_cfg.h(28): warning C4273: 'calloc': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_malloc.h(62): note: see previous definition of 'calloc'
src/libtom/tomcrypt_cfg.h(29): warning C4273: 'free': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_malloc.h(85): note: see previous definition of 'free'
src/libtom/tomcrypt_cfg.h(31): warning C4273: 'qsort': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_search.h(53): note: see previous definition of 'qsort'
src/libtom/tomcrypt_cfg.h(35): warning C4273: 'clock': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\time.h(137): note: see previous definition of 'clock'
src/libtom/tomcrypt_cipher.h(546): error C2133: 'cipher_descriptor': unknown size
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe' failed with exit status 2

解决办法:
修改src\libtom\tomcrypt.h
在这里插入图片描述

#ifndef TOMCRYPT_H_
#define TOMCRYPT_H_
#define LTC_NO_PROTOTYPES
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <limits.h>

2、修改src\libtom\tomcrypt_cypher.h
在这里插入图片描述
3、修改setup.py
在这里插入图片描述

if __name__ == '__main__':
    if (sys.platform == 'win32' and sys.version_info[0] == 3 and
        'build' in sys.argv[1:]):
        PrintErr("\nSecond pass to allow 2to3 to fix nt.py. No cause for alarm.\n")
        touch("./lib/Crypto/Random/OSRNG/nt.py")
        core.setup(**kw)

4、重新安装

python setup.py install

参考:
https://github.com/dlitz/pycrypto/issues/167

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值