1

我无法使用 Python 3.6 在 Windows 10 上运行 Google Closure Linter。我收到以下错误gjslint

PS C:\Windows\system32> gjslint
Traceback (most recent call last):
  File "C:\Program Files\Python36\Scripts\gjslint-script.py", line 11, in <module>
    load_entry_point('closure-linter==2.3.19', 'console_scripts', 'gjslint')()
  File "c:\program files\python36\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\program files\python36\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "c:\program files\python36\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
    return self.resolve()
  File "c:\program files\python36\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\program files\python36\lib\site-packages\closure_linter\gjslint.py", line 176
    print '%s: %d' % (path, len(path_errors))
                 ^
SyntaxError: invalid syntax
4

1 回答 1

0

你应该把它换成

print ('%s: %d' % (path, len(path_errors)))

在 Python 2 中,print 是一个语句,但在 Python 3 中,print() 是一个函数,我建议使用类似的格式print ('{0}: {1}'.format (path, len(path_errors)))

于 2017-03-13T15:46:07.997 回答