0

使用 of 执行脚本from bs4 import BeautifulSoup会出现以下错误:

Traceback (most recent call last):
  File "C:\Users\Stewart\Desktop\dorkscan.py", line 13, in <module>
    from bs4 import BeautifulSoup  
  File "C:\PentestBox\base\python\Lib\site-packages\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`).'
4

1 回答 1

0

看来您正在尝试在 Python3 中运行 Python2 版本的 bs4。要解决此问题,您应该安装正确版本的 bs4。

  • 如果你想用python2写pip install BeautifulSoup4
  • 蟒蛇3pip3 install BeautifulSoup4

以后,你应该注意python给出的错误信息。他们信息量很大。例如,你的说

'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.'

错误消息中给出了解决方案。

于 2018-03-02T20:34:25.540 回答