[英]why is python 2.7 "Acting" like python 3?
i just started learning Python (w no prior programing experience whatsoever) so i was asked to get TextWrangler and type: print "hello world"
(of course) and then RUN it through Terminal app on Mac.我刚开始学习 Python(之前没有任何编程经验),所以我被要求获取 TextWrangler 并输入:
print "hello world"
(当然),然后通过 Mac 上的终端应用程序运行它。 i was also asked to use Python 2.7 NOT Python 3!!!我还被要求使用 Python 2.7 而不是 Python 3!!! but when i wrote the line as i was told to on the video
print "Hello World"
the Terminal app showed a syntax err!但是当我按照视频
print "Hello World"
的指示写下这行时,终端应用程序显示语法错误! when i wrote the line print ("hello world")
then it went through with no problem and was executed by Terminal.当我写行
print ("hello world")
它毫无问题地通过并由终端执行。 why is my python 2.7 acting like python 3, if i can put it that way?如果我可以这样说,为什么我的 python 2.7 表现得像 python 3? When i type
python --version
in terminal it shows that i run 2.7 version.当我在终端中输入
python --version
,它显示我运行的是 2.7 版本。 Thanks.谢谢。
您可以在终端中通过冲突版本明确请求 python 2 shell,如下所示:
alias python='python2'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.