在python3.下安装bs4安装好,在from bs4 import 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
).'
查了好多的解决方法,基本都不管。
下面是我这边可行的一个方法。
1:py3,还是照常安装。
2:如果已经出错,命令行执行
c:\Python34\Scripts\pip.exe uninstall beautifulsoup4
3:命令行执行:
c:\Python34\Scripts\pip.exe install beautifulsoup4
4:测试:
c:\Python34\python.exe
help('modules')
from bs4 import BeautifulSoup
py3.5下安装bs4
1:这里要下载BS4.4版本 因为4.4以下的不兼容Python 3.5 Index of /software/BeautifulSoup/bs4/download/4
2:解压
3:cd 到解压的目录,然后命令:py -3 setup.py install
4:打开py -3 执行 from bs4 import BeautifulSoup测试。