我无法使用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
答案 0 :(得分:0)
您应将其替换为
print ('%s: %d' % (path, len(path_errors)))
在Python 2中,print是一个声明,但在Python 3中,print()是一个函数
另外,我建议使用print ('{0}: {1}'.format (path, len(path_errors)))