Python 3.4安装bs4-运行Python2而不是Python3 [英] Python 3.4 Installing bs4- Running Python2 not Python3
问题描述
今天对我来说是可怕的一天.我很沮丧,因为我花了最后4个小时尝试安装beautifulsoup4
.我搜索了所有可以动手的教程.
它已安装在我的计算机上,但是当我在外壳上执行import bs4
时,它会显示以下消息:
Today is a terrible day for me. I'm so frustrated because I've spent the last 4 hours trying to install beautifulsoup4
. I've searched every tutorial I can get my hands on.
It is installed on my computer, but when I do import bs4
on the shell it gives me this message:
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
import bs4
File "C:\Python34\lib\bs4\__init__.py", line 48
'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`).'
有人知道我能做什么吗?它告诉我运行命令,但没有告诉我如何运行该命令.
Does anyone have any idea what I can do? it tells me to run a command but it doesn't tell me how to run it.
推荐答案
答案在问题中.在bs4所在的文件夹中(您也可以在工作文件夹中下载bs4),运行:
The answer is in the question. In the folder where bs4 is located (you could download bs4 in you work folder also), run :
2to3 -w bs4
2to3 -w bs4
这篇关于Python 3.4安装bs4-运行Python2而不是Python3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!