【发布时间】:2019-11-26 05:55:42
【问题描述】:
我需要一个简单的密码哈希函数,并认为我可以使用hashlib。 PyCharm 建议通过运行pip install hashLib 来安装它。
但是现在 PyCharm 正在抱怨库中的语法错误:
Collecting hashLib
Using cached https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/setup.py", line 68
print "unknown OS, please update setup.py"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("unknown OS, please update setup.py")?
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/
这表明这可能与我正在使用的 Python 版本有关(我尝试使用 Python 2.7 和 Python 3.8,但它们都不起作用)。
确保您使用的是此软件包支持的 Python 版本。 目前您使用的是 Python 3.8。
【问题讨论】:
-
你是怎么安装的?
-
在项目解释器中添加并安装包hashlib
-
您对标准库中的
hashlib不满意? -
"这是 Python 2.5 中包含的 hashlib 库的独立打包,因此可以在旧版本的 Python 上使用(在 2.3 和 2.4 上测试)。"
-
是的...我明白了,但 PyCharm 建议我这个解决方案(安装 hashlib)