首先pycrypto 項(xiàng)目已經(jīng)不在更新了,自己開發(fā)可以使用cryptography、pycryptodome
https://pypi.org/project/cryptography/
https://pypi.org/project/pycryptodome/
關(guān)于python使用Crypto.Cipher模塊,安裝pycrypto ,ImportError: No module named 'Crypto' ?常見問題及解決方案如下:
?文章來源地址http://www.zghlxwxcb.cn/news/detail-436455.html
1. ?需要安裝:Microsoft Visual C++ 14.0
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
安裝VC
只要版本大于等于Microsoft Visual C++ 14.0??就可以,對應(yīng)的VS版本高于2015就可以
微軟官方VC下載地址
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
也可以安裝vs 桌面版本,會自動(dòng)安裝VC,相對會比較大,下載Community版本即可,安裝時(shí)"使用c++的桌面開發(fā)"
微軟官網(wǎng)下載地址
https://visualstudio.microsoft.com/zh-hans/?
https://my.visualstudio.com/Downloads?q=visual%20studio%202019&wt.mc_id=o~msft~vscom~older-downloads
?
2. 安裝VC 以后,inttypes.h 報(bào)錯(cuò)
報(bào)錯(cuò)信息:
ucrt\inttypes.h(26): error C2061: syntax error: identifier ‘intmax_t‘ error C2061: 語法錯(cuò)誤: 標(biāo)識符“intmax_t”; error C2059: 語法錯(cuò)誤:“;” ; error C2143: 語法錯(cuò)誤: 缺少“{”(在“__cdecl”的前面)
?
以下兩種方案都可以使用
解決辦法1:手動(dòng)修改默認(rèn)vs文件
(1) 復(fù)制 stdint.h到系統(tǒng)目錄下 # 默認(rèn)路徑如下,注意自己安裝vs的實(shí)際路徑 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\stdint.h 到 C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\下 (2) 修改inttypes.h文件, C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\inttypes.h 將第13行 #include <stdint.h> 修改為 #include "stdint.h" (3) 重新安裝 pycrypto
?
解決方法2:設(shè)置vs環(huán)境變量
# cmd 下執(zhí)行 cd \ cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC vcvarsall.bat x86_amd64 ----------- # PyCharm 終端下執(zhí)行 # 設(shè)置 stdint.h set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\stdint.h" # 安裝pycrypto pip install pycrypto
?
?
3. Crypto首字母大小寫問題
代碼中引用Crypto 首字母大寫,實(shí)際安裝后模塊目錄下?Lib/site-packages/crypto ?目錄是小寫,可以直接將該目錄改成首字母大寫的Crypto文章來源:http://www.zghlxwxcb.cn/news/detail-436455.html
?
到了這里,關(guān)于Windows 安裝 pycrypto 常見問題解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!