python - 我如何绕过 "No module named ' Crypto' "error after doing "pip install pycrypto"?

标签 python python-3.x pycrypto

基本上,我想带Chemobot进入我自己的聊天室之一,它的创建者建议我应该在我自己的机器上运行 .py 脚本。我才刚刚开始使用 Python 编程,目前我的第一个兴趣是运行该文件。

我正在使用:

  • 要运行的 Windows 命令提示符 (cmd)
  • Python 3.6(我对此感到不安,他用2.7运行代码)
  • Windows 8.1
  • Notepad++ 编辑文件
  • 我被提示从 here 安装的 Visual C++ 2015 构建工具.

我遇到的错误:

但是当我输入命令 python main.py 时,出现以下错误:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Python36>python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import chatbot, random, shutil, time, urllib, sys, upsidedown, threading
  File "C:\Python36\chatbot.py", line 3, in <module>
    import requests, codecs, time, json, getpass, threading, os, linecache, sys,
 simplecrypt
  File "C:\Python36\lib\site-packages\simplecrypt\__init__.py", line 2, in <modu
le>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'

C:\Python36>

运行 pip install pycrypto 给我以下错误:

    creating build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\AES.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\ARC2.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\ARC4.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\blockalgo.py -> build\lib.win-amd64-3.6\Crypto\Cip
her
    copying lib\Crypto\Cipher\Blowfish.py -> build\lib.win-amd64-3.6\Crypto\Ciph
er
    copying lib\Crypto\Cipher\CAST.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\DES.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\DES3.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\PKCS1_OAEP.py -> build\lib.win-amd64-3.6\Crypto\Ci
pher
    copying lib\Crypto\Cipher\PKCS1_v1_5.py -> build\lib.win-amd64-3.6\Crypto\Ci
pher
    copying lib\Crypto\Cipher\XOR.py -> build\lib.win-amd64-3.6\Crypto\Cipher
    copying lib\Crypto\Cipher\__init__.py -> build\lib.win-amd64-3.6\Crypto\Ciph
er
    creating build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\asn1.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\Counter.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\number.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\py3compat.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\randpool.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\RFC1751.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\winrandom.py -> build\lib.win-amd64-3.6\Crypto\Util
    copying lib\Crypto\Util\_number_new.py -> build\lib.win-amd64-3.6\Crypto\Uti
l
    copying lib\Crypto\Util\__init__.py -> build\lib.win-amd64-3.6\Crypto\Util
    creating build\lib.win-amd64-3.6\Crypto\Random
    copying lib\Crypto\Random\random.py -> build\lib.win-amd64-3.6\Crypto\Random

    copying lib\Crypto\Random\_UserFriendlyRNG.py -> build\lib.win-amd64-3.6\Cry
pto\Random
    copying lib\Crypto\Random\__init__.py -> build\lib.win-amd64-3.6\Crypto\Rand
om
    creating build\lib.win-amd64-3.6\Crypto\Random\Fortuna
    copying lib\Crypto\Random\Fortuna\FortunaAccumulator.py -> build\lib.win-amd
64-3.6\Crypto\Random\Fortuna
    copying lib\Crypto\Random\Fortuna\FortunaGenerator.py -> build\lib.win-amd64
-3.6\Crypto\Random\Fortuna
    copying lib\Crypto\Random\Fortuna\SHAd256.py -> build\lib.win-amd64-3.6\Cryp
to\Random\Fortuna
    copying lib\Crypto\Random\Fortuna\__init__.py -> build\lib.win-amd64-3.6\Cry
pto\Random\Fortuna
    creating build\lib.win-amd64-3.6\Crypto\Random\OSRNG
    copying lib\Crypto\Random\OSRNG\fallback.py -> build\lib.win-amd64-3.6\Crypt
o\Random\OSRNG
    copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win-amd64-3.6\Crypto\Rand
om\OSRNG
    copying lib\Crypto\Random\OSRNG\posix.py -> build\lib.win-amd64-3.6\Crypto\R
andom\OSRNG
    copying lib\Crypto\Random\OSRNG\rng_base.py -> build\lib.win-amd64-3.6\Crypt
o\Random\OSRNG
    copying lib\Crypto\Random\OSRNG\__init__.py -> build\lib.win-amd64-3.6\Crypt
o\Random\OSRNG
    creating build\lib.win-amd64-3.6\Crypto\SelfTest
    copying lib\Crypto\SelfTest\st_common.py -> build\lib.win-amd64-3.6\Crypto\S
elfTest
    copying lib\Crypto\SelfTest\__init__.py -> build\lib.win-amd64-3.6\Crypto\Se
lfTest
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\common.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_AES.py -> build\lib.win-amd64-3.6\Cr
ypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_ARC2.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_ARC4.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_Blowfish.py -> build\lib.win-amd64-3
.6\Crypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_CAST.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_DES.py -> build\lib.win-amd64-3.6\Cr
ypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_DES3.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_pkcs1_15.py -> build\lib.win-amd64-3
.6\Crypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_pkcs1_oaep.py -> build\lib.win-amd64
-3.6\Crypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\test_XOR.py -> build\lib.win-amd64-3.6\Cr
ypto\SelfTest\Cipher
    copying lib\Crypto\SelfTest\Cipher\__init__.py -> build\lib.win-amd64-3.6\Cr
ypto\SelfTest\Cipher
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\common.py -> build\lib.win-amd64-3.6\Crypto
\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_HMAC.py -> build\lib.win-amd64-3.6\Cry
pto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_MD2.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_MD4.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_MD5.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_RIPEMD.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_SHA.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_SHA224.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_SHA256.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_SHA384.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\test_SHA512.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Hash
    copying lib\Crypto\SelfTest\Hash\__init__.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Hash
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Protocol
    copying lib\Crypto\SelfTest\Protocol\test_AllOrNothing.py -> build\lib.win-a
md64-3.6\Crypto\SelfTest\Protocol
    copying lib\Crypto\SelfTest\Protocol\test_chaffing.py -> build\lib.win-amd64
-3.6\Crypto\SelfTest\Protocol
    copying lib\Crypto\SelfTest\Protocol\test_KDF.py -> build\lib.win-amd64-3.6\
Crypto\SelfTest\Protocol
    copying lib\Crypto\SelfTest\Protocol\test_rfc1751.py -> build\lib.win-amd64-
3.6\Crypto\SelfTest\Protocol
    copying lib\Crypto\SelfTest\Protocol\__init__.py -> build\lib.win-amd64-3.6\
Crypto\SelfTest\Protocol
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\PublicKey
    copying lib\Crypto\SelfTest\PublicKey\test_DSA.py -> build\lib.win-amd64-3.6
\Crypto\SelfTest\PublicKey
    copying lib\Crypto\SelfTest\PublicKey\test_ElGamal.py -> build\lib.win-amd64
-3.6\Crypto\SelfTest\PublicKey
    copying lib\Crypto\SelfTest\PublicKey\test_importKey.py -> build\lib.win-amd
64-3.6\Crypto\SelfTest\PublicKey
    copying lib\Crypto\SelfTest\PublicKey\test_RSA.py -> build\lib.win-amd64-3.6
\Crypto\SelfTest\PublicKey
    copying lib\Crypto\SelfTest\PublicKey\__init__.py -> build\lib.win-amd64-3.6
\Crypto\SelfTest\PublicKey
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Random
    copying lib\Crypto\SelfTest\Random\test_random.py -> build\lib.win-amd64-3.6
\Crypto\SelfTest\Random
    copying lib\Crypto\SelfTest\Random\test_rpoolcompat.py -> build\lib.win-amd6
4-3.6\Crypto\SelfTest\Random
    copying lib\Crypto\SelfTest\Random\test__UserFriendlyRNG.py -> build\lib.win
-amd64-3.6\Crypto\SelfTest\Random
    copying lib\Crypto\SelfTest\Random\__init__.py -> build\lib.win-amd64-3.6\Cr
ypto\SelfTest\Random
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Random\Fortuna
    copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaAccumulator.py -> bui
ld\lib.win-amd64-3.6\Crypto\SelfTest\Random\Fortuna
    copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaGenerator.py -> build
\lib.win-amd64-3.6\Crypto\SelfTest\Random\Fortuna
    copying lib\Crypto\SelfTest\Random\Fortuna\test_SHAd256.py -> build\lib.win-
amd64-3.6\Crypto\SelfTest\Random\Fortuna
    copying lib\Crypto\SelfTest\Random\Fortuna\__init__.py -> build\lib.win-amd6
4-3.6\Crypto\SelfTest\Random\Fortuna
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\test_fallback.py -> build\lib.win-a
md64-3.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\test_generic.py -> build\lib.win-am
d64-3.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\test_nt.py -> build\lib.win-amd64-3
.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\test_posix.py -> build\lib.win-amd6
4-3.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\test_winrandom.py -> build\lib.win-
amd64-3.6\Crypto\SelfTest\Random\OSRNG
    copying lib\Crypto\SelfTest\Random\OSRNG\__init__.py -> build\lib.win-amd64-
3.6\Crypto\SelfTest\Random\OSRNG
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Util
    copying lib\Crypto\SelfTest\Util\test_asn1.py -> build\lib.win-amd64-3.6\Cry
pto\SelfTest\Util
    copying lib\Crypto\SelfTest\Util\test_Counter.py -> build\lib.win-amd64-3.6\
Crypto\SelfTest\Util
    copying lib\Crypto\SelfTest\Util\test_number.py -> build\lib.win-amd64-3.6\C
rypto\SelfTest\Util
    copying lib\Crypto\SelfTest\Util\test_winrandom.py -> build\lib.win-amd64-3.
6\Crypto\SelfTest\Util
    copying lib\Crypto\SelfTest\Util\__init__.py -> build\lib.win-amd64-3.6\Cryp
to\SelfTest\Util
    creating build\lib.win-amd64-3.6\Crypto\SelfTest\Signature
    copying lib\Crypto\SelfTest\Signature\test_pkcs1_15.py -> build\lib.win-amd6
4-3.6\Crypto\SelfTest\Signature
    copying lib\Crypto\SelfTest\Signature\test_pkcs1_pss.py -> build\lib.win-amd
64-3.6\Crypto\SelfTest\Signature
    copying lib\Crypto\SelfTest\Signature\__init__.py -> build\lib.win-amd64-3.6
\Crypto\SelfTest\Signature
    creating build\lib.win-amd64-3.6\Crypto\Protocol
    copying lib\Crypto\Protocol\AllOrNothing.py -> build\lib.win-amd64-3.6\Crypt
o\Protocol
    copying lib\Crypto\Protocol\Chaffing.py -> build\lib.win-amd64-3.6\Crypto\Pr
otocol
    copying lib\Crypto\Protocol\KDF.py -> build\lib.win-amd64-3.6\Crypto\Protoco
l
    copying lib\Crypto\Protocol\__init__.py -> build\lib.win-amd64-3.6\Crypto\Pr
otocol
    creating build\lib.win-amd64-3.6\Crypto\PublicKey
    copying lib\Crypto\PublicKey\DSA.py -> build\lib.win-amd64-3.6\Crypto\Public
Key
    copying lib\Crypto\PublicKey\ElGamal.py -> build\lib.win-amd64-3.6\Crypto\Pu
blicKey
    copying lib\Crypto\PublicKey\pubkey.py -> build\lib.win-amd64-3.6\Crypto\Pub
licKey
    copying lib\Crypto\PublicKey\RSA.py -> build\lib.win-amd64-3.6\Crypto\Public
Key
    copying lib\Crypto\PublicKey\_DSA.py -> build\lib.win-amd64-3.6\Crypto\Publi
cKey
    copying lib\Crypto\PublicKey\_RSA.py -> build\lib.win-amd64-3.6\Crypto\Publi
cKey
    copying lib\Crypto\PublicKey\_slowmath.py -> build\lib.win-amd64-3.6\Crypto\
PublicKey
    copying lib\Crypto\PublicKey\__init__.py -> build\lib.win-amd64-3.6\Crypto\P
ublicKey
    creating build\lib.win-amd64-3.6\Crypto\Signature
    copying lib\Crypto\Signature\PKCS1_PSS.py -> build\lib.win-amd64-3.6\Crypto\
Signature
    copying lib\Crypto\Signature\PKCS1_v1_5.py -> build\lib.win-amd64-3.6\Crypto
\Signature
    copying lib\Crypto\Signature\__init__.py -> build\lib.win-amd64-3.6\Crypto\S
ignature
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastm
ath.
    building 'Crypto.Random.OSRNG.winrandom' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Ic:\users\shailendra
\appdata\local\programs\python\python36\include -Ic:\users\shailendra\appdata\lo
cal\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.1
0240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Pr
ogram Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows
 Kits\8.1\include\winrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.6\Release\sr
c/winrand.obj
    winrand.c
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
26): error C2061: syntax error: identifier 'intmax_t'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
27): error C2061: syntax error: identifier 'rem'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
27): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
28): error C2059: syntax error: '}'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
30): error C2061: syntax error: identifier 'imaxdiv_t'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
30): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
40): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
41): error C2146: syntax error: missing ')' before identifier '_Number'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
41): error C2061: syntax error: identifier '_Number'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
41): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
42): error C2059: syntax error: ')'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
45): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
46): error C2146: syntax error: missing ')' before identifier '_Numerator'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
46): error C2061: syntax error: identifier '_Numerator'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
46): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
46): error C2059: syntax error: ','
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
48): error C2059: syntax error: ')'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
50): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
56): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
63): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
69): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
76): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
82): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
89): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(
95): error C2143: syntax error: missing '{' before '__cdecl'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B
IN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\shailendra\appdata\local\programs\python\python36\python.exe -
u -c "import setuptools, tokenize;__file__='C:\\Users\\SHAILE~1\\AppData\\Local\
\Temp\\pip-build-g1i38ndu\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi
le__, 'exec'))" install --record C:\Users\SHAILE~1\AppData\Local\Temp\pip-3g33l4
mb-record\install-record.txt --single-version-externally-managed --compile" fail
ed with error code 1 in C:\Users\SHAILE~1\AppData\Local\Temp\pip-build-g1i38ndu\
pycrypto\

C:\Python36>

我什至尝试过 easy_install pycrypto,但我得到一个错误:

C:\Python36>easy_install pycrypto
Searching for pycrypto
Reading https://pypi.python.org/simple/pycrypto/
Downloading https://pypi.python.org/packages/60/db/645aa9af249f059cc3a368b118de3
3889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf516
1a0d5d7eda
Best match: pycrypto 2.6.1
Processing pycrypto-2.6.1.tar.gz
Writing C:\Users\SHAILE~1\AppData\Local\Temp\easy_install-2dyhm9q2\pycrypto-2.6.
1\setup.cfg
Running pycrypto-2.6.1\setup.py -q bdist_egg --dist-dir C:\Users\SHAILE~1\AppDat
a\Local\Temp\easy_install-2dyhm9q2\pycrypto-2.6.1\egg-dist-tmp-ttmqpx92
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26):
 error C2061: syntax error: identifier 'intmax_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27):
 error C2061: syntax error: identifier 'rem'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27):
 error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28):
 error C2059: syntax error: '}'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30):
 error C2061: syntax error: identifier 'imaxdiv_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30):
 error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(40):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41):
 error C2146: syntax error: missing ')' before identifier '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41):
 error C2061: syntax error: identifier '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41):
 error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(42):
 error C2059: syntax error: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(45):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46):
 error C2146: syntax error: missing ')' before identifier '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46):
 error C2061: syntax error: identifier '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46):
 error C2059: syntax error: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46):
 error C2059: syntax error: ','
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(48):
 error C2059: syntax error: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(50):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(56):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(63):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(69):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(76):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(82):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(89):
 error C2143: syntax error: missing '{' before '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(95):
 error C2143: syntax error: missing '{' before '__cdecl'
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microso
ft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

C:\Python36>

我的问题:

我做错了什么吗?是兼容性问题吗?我该如何解决这个问题?


(附言:再一次,这是我第一次使用 python - 如果你能用最简单的方式向我解释一下,我将不胜感激。)

最佳答案

看起来 PyCryptonot being maintained currently .所以,你最好切换到 PyCryptodome .

pip install pycryptodome

如果你仍然想使用 PyCrypto,你仍然可以尝试,

https://packaging.python.org/extensions/#setting-up-a-build-environment-on-windows

https://stackoverflow.com/a/33338523/887007

https://stackoverflow.com/a/27327236/887007

关于python - 我如何绕过 "No module named ' Crypto' "error after doing "pip install pycrypto"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43994590/

相关文章:

python - 赋值前引用的局部变量?

python - 我有模数和私有(private)指数。如何构造RSA私钥并对消息进行签名?

macos - 无法使用推荐的 Homebrew 和 pip 在 OSX 上安装 Fabric。 Xcode 是最新版本

python - 如何编写一个每次运行都给出相同输出的 Python 程序?

python - 安装基于 pyproject.toml 的项目所需的错误 : Could not build wheels for pycocotools,

python - 没有名为 Yum 的模块用于安装 mysql db

python - 迭代随机种子的整数是否合适?

python - python中的pycrypto和crypto包有什么区别?

python - sympy modulo 不适用于非交换表达式

python - 创建了多维数组,但输出不符合预期