首页 新闻 会员 周边 捐助

selenium提示乱码

0
悬赏园豆:100 [待解决问题]

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?

Darren23的主页 Darren23 | 初学一级 | 园豆:102
提问于:2017-08-15 15:53
< >
分享
所有回答(3)
0

参考链接:http://www.51testing.com/html/34/369434-829133.html

金琥 | 园豆:2605 (老鸟四级) | 2017-08-15 16:00
0

检查如下地方:

第一行有没有加 # coding = utf-8

from selenium import webdriver

另外关于BeautifulSoup乱码参考如下:

http://www.jb51.net/article/49220.htm

ycyzharry | 园豆:25683 (高人七级) | 2017-08-16 11:03
0

这个报错不是乱码的问题吧,你把注释去掉看还没有这个错误.

它说是没有lxml,你可以尝试装一下lxml,pip install lxml

windows经常装不上,需要下载手动安装

地址   https://pypi.python.org/pypi/lxml/

前面说的没有声明utf-8,是注释乱码的解决问题

但是没有声明的话貌似应该报错SyntaxError

Masako | 园豆:1893 (小虾三级) | 2017-08-23 17:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册