E:\python>python first.py
Traceback (most recent call last):
File "first.py", line 1, in <module>
from selenium import webdriver
File "C:\Python27\lib\site-packages\selenium-3.0.2-py2.7.egg\selenium\webdrive
r\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Python27\lib\site-packages\selenium-3.0.2-py2.7.egg\selenium\webdrive
r\firefox\webdriver.py", line 19, in <module>
import http.client as http_client
File "E:\python\http.py", line 13, in <module>
Soup = BeautifulSoup(start_html.text, 'lxml') ##浣跨敤BeautifulSoup鏉ヨВ鏋
愭垜浠幏鍙栧埌鐨勭綉椤碉紙鈥榣xml鈥欐槸鎸囧畾鐨勮В鏋愬櫒 鍏蜂綋璇峰弬鑰冨畼鏂
规枃妗e摝锛?
File "C:\Python27\lib\site-packages\bs4\__init__.py", line 155, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requeste
d: lxml. Do you need to install a parser library?
参考链接:http://www.51testing.com/html/34/369434-829133.html
检查如下地方:
第一行有没有加 # coding = utf-8
from selenium import webdriver
另外关于BeautifulSoup乱码参考如下:
http://www.jb51.net/article/49220.htm
这个报错不是乱码的问题吧,你把注释去掉看还没有这个错误.
它说是没有lxml,你可以尝试装一下lxml,pip install lxml
windows经常装不上,需要下载手动安装
地址 https://pypi.python.org/pypi/lxml/
前面说的没有声明utf-8,是注释乱码的解决问题
但是没有声明的话貌似应该报错SyntaxError