我已经将pycrypto(版本2.3)安装到/usr/local/lib/python2.6/dist-packages/Crypto/,我可以在那里看到Random包.
但是当我尝试导入Crypto.Random时,它让我大吃一惊
from Crypto.Random import *
ImportError: No module named Random
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会发生这种情况?谢谢.
import Crypto
import os
print(Crypto.__file__);
print (dir(Crypto));
print(os.listdir(os.path.dirname(Crypto.__file__)))
Run Code Online (Sandbox Code Playgroud)
结果:
/usr/lib/python2.6/dist-packages/Crypto/__init__.pyc
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__revision__', '__version__']
['Hash', 'Protocol', 'PublicKey', 'test.py', 'Util', 'test.pyc', '__init__.pyc', '__init__.py', 'Cipher']
Run Code Online (Sandbox Code Playgroud) 我在我的计算机上多次运行我的代码,但没有出现此错误。但突然间这个来了
File "e:\Python 3.8.0\lib\site-packages\comtypes\client\_code_cache.py", lin
import ctypes, logging, os, sys, tempfile, types
File "e:\Python 3.8.0\lib\tempfile.py", line 45, in <module>
from random import Random as _Random
ImportError: cannot import name 'Random' from 'random' (e:\python codes\random
Run Code Online (Sandbox Code Playgroud)