- ImportError: cannot import name Random
1 문제상황[ | ]
Console
Copy
[root@zetawiki ~]# python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from Crypto import Random
ImportError: cannot import name Random
2 Crypto 모듈 버전 확인[ | ]
Console
Copy
[root@zetawiki ~]# python -c 'import Crypto; print( Crypto.__version__ );'
2.0.1
- → 버전이 낮음. Crypto.Random은 2.1.0alpha1 에서 추가됨
3 pycrypto 업그레이드[ | ]

4 확인[ | ]
Console
Copy
[root@zetawiki ~]# pip list | grep pycrypto
pycrypto (2.6.1)
Console
Copy
[root@zetawiki ~]# python -c 'import Crypto; print( Crypto.__version__ );'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named Crypto
- → ??? 업그레이드가 되었는데도 안된다..
5 pycrypto 재설치[ | ]
Console
Copy
[root@zetawiki ~]# pip uninstall pycrypto
Uninstalling pycrypto:
/usr/lib64/python2.6/site-packages/Crypto/Cipher/AES.py
/usr/lib64/python2.6/site-packages/Crypto/Cipher/AES.pyc
... (생략)
/usr/lib64/python2.6/site-packages/Crypto/pct_warnings.pyc
/usr/lib64/python2.6/site-packages/pycrypto-2.6.1-py2.6.egg-info
Proceed (y/n)? y
Successfully uninstalled pycrypto
Console
Copy
[root@zetawiki ~]# pip install pycrypto
Downloading/unpacking pycrypto
Running setup.py egg_info for package pycrypto
Installing collected packages: pycrypto
Running setup.py install for pycrypto
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
Successfully installed pycrypto
Cleaning up...
6 확인 2[ | ]
Console
Copy
[root@zetawiki ~]# python -c 'import Crypto; print( Crypto.__version__ );'
2.6.1
7 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.