您的位置:首页 > 编程语言 > Python开发

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

2017-09-19 09:06 1336 查看
 在python3下直接使用安装的BeautifulSoup包会提示下面这段错误:

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`)


解决方案之一:

将beautifulsoup文件夹下的bs4转换成python3的版本即可,

使用python3安装目录下lib文件夹中的2to3命令

如果将python3添加到了环境变量中则可以直接使用命令,如果没有则需要定位到python3安装目录下的lib目录

2to3
/beautifulsoup/bs4(beautifulsoup安装目录下的bs4) -w

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐