How do I get around the “ No module named 'Crypto' ” error after doing “pip install pycrypto”?

前提是你 提交于 2020-08-23 09:49:11

问题


Basically, I'm trying to bring Chemobot into one of my own chatrooms, and its creator has suggested me that I should run the .py script on my own machine. I've barely started programming in python and my first interest as of now is to run that file.

I'm using:

  • Windows command prompt (cmd) to run
  • Python 3.6 (I'm uneasy about this, he run the code with 2.7)
  • Windows 8.1
  • Notepad++ to edit files
  • Visual C++ 2015 Build Tools which I was prompted to install from here.

Errors I'm getting:

However when I enter the command python main.py, I get the following error:

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>

Running pip install pycrypto gives me the following error:

    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>

I've even tried easy_install pycrypto, yet I get an error:

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>

My Questions:

Am I doing something wrong? Is it a compatibility issue? How do I get around this?


(P.S.: Once again, this is my first time even using python – I'd be grateful if you could explain me this in the easiest way you can.)


回答1:


It looks like PyCrypto is not being maintained currently. So, it's better you switch to PyCryptodome.

pip install pycryptodome

If you still want to use PyCrypto you could still try,

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

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

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




回答2:


If doing python -m Cryptodome.SelfTest is giving you an error, you can do:

pip uninstall pycryptodome

and then:

easy_install pycryptodome

Even after this, running python -m Cryptodome.SelfTest was giving me an error, but when I re-ran the file, it worked.



来源:https://stackoverflow.com/questions/43994590/how-do-i-get-around-the-no-module-named-crypto-error-after-doing-pip-inst

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!