安装hashLib会产生SyntaxError:对"print"的调用中缺少括号 [英] Installing hashLib gives SyntaxError: Missing parentheses in call to 'print'

查看:1036
本文介绍了安装hashLib会产生SyntaxError:对"print"的调用中缺少括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个简单的哈希函数来输入密码,并认为我可以使用hashlib. PyCharm建议通过运行pip install hashLib进行安装.

I needed a simple hash function for passwords and thought I could use hashlib. PyCharm suggested to install it by running pip install hashLib.

但是现在PyCharm抱怨该库中的语法错误:

But now PyCharm is complaining about a syntax error in the library:

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,但是它们都不起作用).

It suggests that it may be a problem related to the Python version I am using (I tried with Python 2.7 and Python 3.8, but none of them worked).

确保使用此程序包支持的Python版本. 当前,您正在使用Python 3.8.

Make sure that you use a version of Python supported by this package. Currently you are using Python 3.8.

推荐答案

hashlib 现在在标准库中.这意味着您不需要安装它,Python安装中已经安装了它.

hashlib is in the standard library now. That means you don't need to install it, it's there already with your Python installation.

您尝试从PyPI安装的版本是针对非常的Python旧版本(< = 2.4).

The one you tried to install from PyPI is for very old versions of Python (<= 2.4).

这篇关于安装hashLib会产生SyntaxError:对"print"的调用中缺少括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆