(python)错误:尝试使用x=input(“字符串”)会导致错误

(python)错误:尝试使用x=input(“字符串”)会导致错误,python,python-3.x,linux,google-chrome,chromebook,Python,Python 3.x,Linux,Google Chrome,Chromebook,当我输入这个时也是一样的: x = input("press enter to continue") 再说一遍: input("press enter to continue") 我在chrome acer上运行linux,linux测试版。它使用Python3。出了什么问题?尝试使用原始输入()而不是输入()我相信您使用的是Python 2,而不是Python 3。将输入替换为原始输入: x=原始输入(“按回车键继续”) 这就是为什么我相信您正在使用Python 2。我对Python 3

当我输入这个时也是一样的:

x = input("press enter to continue")
再说一遍:

input("press enter to continue")

我在chrome acer上运行linux,linux测试版。它使用Python3。出了什么问题?

尝试使用原始输入()而不是输入()

我相信您使用的是Python 2,而不是Python 3。将
输入
替换为
原始输入

x=原始输入(“按回车键继续”)


这就是为什么我相信您正在使用Python 2。我对Python 3的测试(注意没有错误):

然后我看到了与使用Python 2时相同的错误:

Python 3.7.6
Type "help", "copyright", "credits" or "license" for more information.
>>> x = input("press enter to continue")
press enter to continue
>>>
python2.7.17
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>x=输入(“按enter键继续”)
按enter键继续
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“”,第0行
^
SyntaxError:分析时出现意外的EOF
>>>x=原始输入(“按回车键继续”)
按enter键继续
>>>

您确定使用的是python 3吗?我在终端中输入了python 3,然后它就工作了,但不是作为脚本的一部分。
原始输入是用于python 2的。他正在使用Python3。它实际上起了作用。如何检查它正在使用什么,我以为我安装了python3,我相信他正在使用Python2.7,否则他不会出现这个错误。在终端中键入这个:python--version然后键入这个:python3--version在终端中运行和在script@joshuarobbins你能给我们看一下脚本的其余部分吗?根据你的评论,你使用的是Python 2.7.13,因此如果你将
input
改为使用
raw\u input
,你的脚本就可以工作了。结果是IDE没有使用更新的Python版本,这导致了错误。
input('press enter to continue')
Python 3.7.6
Type "help", "copyright", "credits" or "license" for more information.
>>> x = input("press enter to continue")
press enter to continue
>>>
Python 2.7.17
Type "help", "copyright", "credits" or "license" for more information.
>>> x = input("press enter to continue")
press enter to continue
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 0

    ^
SyntaxError: unexpected EOF while parsing
>>> x = raw_input("press enter to continue")
press enter to continue
>>>