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
windows安装pycrypto出现cl.exe' failed with exit status 2_第1张图片

#ifndef TOMCRYPT_H_
#define TOMCRYPT_H_
#define LTC_NO_PROTOTYPES
#include 
#include 
#include 
#include 
#include 
#include 
#include 

2、修改src\libtom\tomcrypt_cypher.h
windows安装pycrypto出现cl.exe' failed with exit status 2_第2张图片
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

你可能感兴趣的:(服务器那些事)