1. 程式人生 > >vs安裝pycrypto-2.6.1報錯處理

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
編譯即可。