Lỗi trong Python No module named Crypto.Util.number

Em chào mn, em mới học Python, em có chạy 1 file .py bằng IDLE python 2.7.14, nó báo lỗi như sau :
Traceback (most recent call last):
File “E:\SOURCE\PYTHON\crypto.py”, line 1, in
from Crypto.Util.number import *
ImportError: No module named Crypto.Util.number

đây là chương trình của em :

from Crypto.Util.number import *
from gmpy2 import *

e = 3 
c1 = 261345950255088824199206969589297492768083568554363001807292202086148198677263604958247638518239089545015544140878441375704999371548235205708718116265184277053405937898051706510050325657424248032017194168466912140157665066494528590260879287464030275170787644749401275343677539640347609231708327119700420050952
n1 = 1001191535967882284769094654562963158339094991366537360172618359025855097846977704928598237040115495676223744383629803332394884046043603063054821999994629411352862317941517957323746992871914047324555019615398720677218748535278252779545622933662625193622517947605928420931496443792865516592262228294965047903627
c2 = 147535246350781145803699087910221608128508531245679654307942476916759248448374688671157343167317710093065456240596223287904483080800880319712443044372346198448258006286828355244986776657425121775659144630571637596283100201930037799979864768887420615134036083295810488407488056595808231221356565664602262179441
n2 = 405864605704280029572517043538873770190562953923346989456102827133294619540434679181357855400199671537151039095796094162418263148474324455458511633891792967156338297585653540910958574924436510557629146762715107527852413979916669819333765187674010542434580990241759130158992365304284892615408513239024879592309 
c3 = 633230627388596886579908367739501184580838393691617645602928172655297372282390454586345936209841638502749645277206386289490247066959822668419069562380546618337543323956757811325946190976649051724173510367477564435069180291575386473277111391106753472257905377429144209593931226163885326581862398737742032667573
n3 = 1204664380009414697639782865058772653140636684336678901863196025928054706723976869222235722439176825580211657044153004521482757717615318907205106770256270292154250168657084197056536811063984234635803887040926920542363612936352393496049379544437329226857538524494283148837536712608224655107228808472106636903723 

#Note that: C = pow(M,3,N1*N2*n3)
#Now we're trying to find C = (T1 + T2 + T3) mod (N1*N2*N3)

#T1 = C1*(N2*N3)*invert(N2*N3,N1)
t1 = c1*(n2*n3)*invert(n2*n3,n1)
print "T1 = ",t1

#T2 = C2*(N1*N3)*invert(N1*N3,N2)
t2 = c2*(n1*n3)*invert(n1*n3,n2)
print "T2 = ",t2

#T3 = C3*(N2*N1)*invert(N2*N1,N3)
t3 = c3*(n1*n2)*invert(n1*n2,n3)
print "T3 = ",t3

#Got T1,T2,T3 , Now calculate C 
c = (t1 + t2 + t3) % (n1*n2*n3)
print "C = ",c

#Got C, calculate M
m = str(iroot(c,3)).split('z(')[1].split('L)')[0]
print "M = ",m
print "M in plaintext: ",long_to_bytes(m)

Lỗi này chẳng liên quan gì đến code của bạn cả. Thử xem link này xem:

1 Like

Cảm ơn bạn! Mình đã có manh mối cho vấn đề này :))

Bạn có thể cho mình xin cách giải quyết lỗi này được không?

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?