我在Windows 7上安装了Python3.4,对环境变量进行了更改。这是我的用户变量:
变量:路径值:C:\Python34 34\脚本;
这是我的系统变量:
变量:路径值: C:\ProgramData\Oracle\Java\javapath;C:\Python34;C:\Python34\Scripts;
当我试图从命令提示符运行它时所得到的错误。
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Batman>cd C:\Python34
C:\Python34>cd Scripts
C:\Python34\Scripts>python hello.py
File "hello.py", line 1
print "Hello";
^
SyntaxError: Missing parentheses in call to 'print'
C:\Python34\Scripts>我还有什么不想安装的?
编辑:我转到Python2.x。在从官方网站下载Python时,我看到了这样的东西: Windows x86 MSI程序数据库(2.7.8),这到底是什么意思?
发布于 2014-11-11 13:57:21
发布于 2014-11-11 13:59:06
这不是安装的问题,而是版本兼容性的问题。
在Python3中,print语句改变了,它需要括号,比如:print("Hello")。因此,您正在尝试使用Python 3解释器运行Python 2代码。如果您注意到,您的错误消息根本没有提到安装中的错误。
以下是关于2和3:https://wiki.python.org/moin/Python2orPython3之间差异的一些信息
编辑:我看到你提到美汤。来自汤主页
美丽的汤3只在Python2.x下工作。 ..。 漂亮的Soup 4同时工作在Python2 (2.6+)和Python3上。
所以你需要汤4或更高。
https://stackoverflow.com/questions/26866513
复制相似问题