【问题标题】:Failed to install package Beautiful Soup. Error Message is "SyntaxError: Missing parentheses in call to 'print'"安装包 Beautiful Soup 失败。错误消息是“SyntaxError:调用'print'时缺少括号”
【发布时间】:2016-06-15 08:47:07
【问题描述】:

我已经在我的 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

Python安装文件夹路径为3.5.1 (C:\Program Files (x86)\Python35-32\python.exe)

【问题讨论】:

    标签: python python-3.x beautifulsoup


    【解决方案1】:

    您正在尝试安装 BeautifulSoup 3,它与 Python 3 不兼容。正如 Pycharm 错误窗口所解释的那样:

    确保您使用的是此软件包支持的 Python 版本。目前您使用的是 Python 3.5。

    但是,您想安装 BeautifulSoup 4;该系列的项目名称已更改为beautifulsoup4。 BeautifulSoup 4 已经推出几年了,它支持 Python 3。

    【讨论】:

      【解决方案2】:

      将 Anaconda 与更新的 BeautifulSoup4 一起使用是最简单的。

      conda install BeautifulSoup4
      

      pip3 install BeautifulSoup4
      

      【讨论】:

      • (base) user@system:~$ conda install BeautifulSoup4 Solving environment: done # All requested packages already installed. 仍然抛出相同的错误.. :( 在 pycharm 和普通终端解释器中
      【解决方案3】:

      试试

      pip install BeautifulSoup4
      

      【讨论】:

        【解决方案4】:

        你可以试试

        pip2 install BeautifulSoup4
        

        希望有帮助

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-02-12
          • 2022-01-14
          • 1970-01-01
          • 2011-07-19
          • 1970-01-01
          • 2016-12-08
          • 2014-06-28
          • 1970-01-01
          相关资源
          最近更新 更多