在Windows中使用crypt模块?
在IDLE和Python版本3.3.2中,我尝试像这样调用python模块:
hash2 = crypt(word, salt)
我将其导入程序顶部,如下所示:
from crypt import *
我得到的结果如下:
Traceback (most recent call last):
File "C:\none\of\your\business\adams.py", line 10, in <module>
from crypt import *
File "C:\Python33\lib\crypt.py", line 3, in <module>
import _crypt
ImportError: No module named '_crypt'
但是,当我adams.py
使用Python 2.7.3在Ubuntu中执行同一文件时,它执行得很好-没有错误。
我尝试了以下方法来解决Windows&Python 3.3.2的问题(尽管我确定操作系统不是问题,但Python版本或语法的使用才是问题):
- 将目录中的
Python33
目录从重命名Lib
为lib
- 将
crypt.py
in重命名lib
为_crypt.py
。但是,事实证明,整个crypt.py
模块也依赖于称为的外部模块_crypt.py
。 - 浏览互联网以下载任何类似的远程内容
_crypt.py
不是Python,对吗?是我…(?)我正在使用语法导入和使用2.7.3中可接受的外部模块,而3.2.3中不可接受。还是我在3.3.2中发现了错误?