好像是在python3.5之后,安装了lxml也无法使用etree

为了就解决这个问题使用如下方法:

1、下载lxml的wheel文件,下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

python3.6安装lxml库

 

2、将下载的wheel文件放到python3.6安装lxml库路径下

 

python3.6安装lxml库

 

3、pip安装wheel文件

pip install lxml-4.4.2-cp36-cp36m-win_amd64.whl

4、验证安装

cmd先进入python界面,再输入

from lxml import etree  

无报错表示成功

 

PS.如果Pycharm 使用from lxml import etree 报了个错Unresolved reference 'etree',但是能运行...

解决方法:

其他提示unresolved reference应该也适用吧:

1、点击菜单栏上的File -> Setting ->Build,Executing,Development ->Console -> Python Console

2、将Add source roots to PYTHONPATH勾选上

3、点击Apply

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-06-29
  • 2022-12-23
猜你喜欢
  • 2021-10-26
  • 2022-01-08
  • 2021-06-29
  • 2021-06-03
  • 2021-05-16
  • 2021-08-14
相关资源
相似解决方案