Python 安装包 Beautiful Soup 失败。错误消息是“语法错误:调用‘打印’时缺少括号”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35748239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to install package Beautiful Soup. Error Message is "SyntaxError: Missing parentheses in call to 'print'"
提问by bharadwaj
I have installed Python 3.5 on my Windows 8 Computer. I have also installed Pycharm Community Version 5.0.4. I am not able to install BeautifulSoup Module through Settings Option in Pycharm. I am getting the following error in Pycharm:
我已经在我的 Windows 8 计算机上安装了 Python 3.5。我还安装了 Pycharm 社区版本 5.0.4。我无法通过 Pycharm 中的设置选项安装 BeautifulSoup 模块。我在 Pycharm 中收到以下错误:
Collecting BeautifulSoup
Using cached BeautifulSoup-3.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Kashyap\AppData\Local\Temp\pycharm-packaging0.tmp\BeautifulSoup\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Kashyap\AppData\Local\Temp\pycharm-packaging0.tmp\BeautifulSoup
Path of installed folder of Python is 3.5.1 (C:\Program Files (x86)\Python35-32\python.exe)
Python 的安装文件夹路径为 3.5.1 (C:\Program Files (x86)\Python35-32\python.exe)
回答by Martijn Pieters
You are trying to install BeautifulSoup 3, which is not Python 3 compatible. As the Pycharm error window explains:
您正在尝试安装与 Python 3 不兼容的 BeautifulSoup 3。正如 Pycharm 错误窗口所解释的:
Make sure you use a version of Python supported by this package. Currently you are using Python 3.5.
确保您使用此包支持的 Python 版本。目前您使用的是 Python 3.5。
However, you want to install BeautifulSoup 4instead; the project name for that series has changed to beautifulsoup4
. BeautifulSoup 4 has been out for a few years now and supports Python 3.
但是,您想安装 BeautifulSoup 4;该系列的项目名称已更改为beautifulsoup4
. BeautifulSoup 4 已经推出几年了,并且支持 Python 3。
回答by Edison
Using Anaconda with the more current BeautifulSoup4
is the easiest.
使用电流更大的 AnacondaBeautifulSoup4
是最简单的。
conda install BeautifulSoup4
or
或者
pip3 install BeautifulSoup4
回答by Raghuram Sadineni
Try
尝试
pip install BeautifulSoup4
回答by Zaman
you can try
你可以试试
pip2 install BeautifulSoup4
Hope This Help
希望这有帮助