为了账号安全,请及时绑定邮箱和手机立即绑定

符号有问题

>>> from bs4 import beautifulsoup

Traceback (most recent call last):

  File "<pyshell#0>", line 1, in <module>

    from bs4 import beautifulsoup

  File "C:\Users\ONEPIECE\AppData\Local\Programs\Python\Python35-32\beautifulsoup4-4.5.1.tar\beautifulsoup4-4.5.1\bs4\__init__.py", line 53

    'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.'<>'You need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).'

                                                                                                       ^

SyntaxError: invalid syntax

安装beautifulsoup中出现这个,醉了

正在回答

3 回答

You are trying to run the Python 2 version of Beautiful Soup under Python 3

你在尝试用版本2运行版本3下的Beautiful Soup。

试试 python3+回车键进入python的编辑环境。直接用python+回车,会搜索path变量最先找到的可执行文件,如果你python2的环境变量在3前面,python+回车进入的是2的环境。

0 回复 有任何疑惑可以回复我~

好吧 有人知道python3.5该用哪个版本的bs

0 回复 有任何疑惑可以回复我~

好吧 我是想说install有问题,结果贴上来的代吗没啥关系

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
python遇见数据采集
  • 参与学习       59671    人
  • 解答问题       200    个

本教程让你初步掌握Python进行数据采集,创造属于你的价值

进入课程

符号有问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信