vs安装pycrypto-2.6.1报错处理

错误提示:

winrand.c
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(27): error C2061: 语法错误: 标识符“intmax_t”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(28): error C2061: 语法错误: 标识符“rem”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(28): error C2059: 语法错误:“;”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(29): error C2059: 语法错误:“}”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(31): error C2061: 语法错误: 标识符“imaxdiv_t”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(31): error C2059: 语法错误:“;”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(41): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(42): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(42): error C2061: 语法错误: 标识符“_Number”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(42): error C2059: 语法错误:“;”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(43): error C2059: 语法错误:“)”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(46): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(47): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(47): error C2061: 语法错误: 标识符“_Numerator”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(47): error C2059: 语法错误:“;”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(47): error C2059: 语法错误:“,”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(49): error C2059: 语法错误:“)”
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(51): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(57): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(64): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(70): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(77): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(83): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(90): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
D:\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(96): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

处理方式:
修改文件 setup.py

    def detect_modules (self):
        # Read the config.h file (usually generated by autoconf)
        if self.compiler.compiler_type == 'msvc' and False:
            # Add special include directory for MSVC (because MSVC is special)
            self.compiler.include_dirs.insert(0, "src/inc-msvc/")
            ac = self.__read_autoconf("src/config.h")
        else:
            ac = self.__read_autoconf("src/config.h")

使special失效
然后拷贝\src\inc-msvc\config.h\src\config.h
编译即可。

猜你喜欢

转载自blog.csdn.net/WangZuoChuan/article/details/81287605