问题
I am trying to execute a python script , but I get an error on line
from jinja2.utils import Markup, concat, escape, is_python_keyword, next
ImportError: cannot import name is_python_keyword
I checked there is no file named is_python.py
回答1:
Looking at the source code for 2.3.1 they have a line:
from keyword import iskeyword as is_python_keyword
They are using the builtin keyword
module.
The current version is 2.7.3 so it seems they have changed the code and it is no longer available.
You could use the above import from the builtin module instead.
来源:https://stackoverflow.com/questions/28429229/importerror-cannot-import-name-is-python-keyword