DLL load failed while importing etree: 找不到指定的模块。
今天用Scrapy创建项目时出现以下报错
C:\Users\snake>scrapy
Traceback (most recent call last):
File "E:\Anaconda3\Scripts\scrapy-script.py", line 6, in <module>
from scrapy.cmdline import execute
File "E:\Anaconda3\lib\site-packages\scrapy\__init__.py", line 12, in <module>
from scrapy.spiders import Spider
File "E:\Anaconda3\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <module>
from scrapy.http import Request
File "E:\Anaconda3\lib\site-packages\scrapy\http\__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "E:\Anaconda3\lib\site-packages\scrapy\http\request\form.py", line 11, in <module>
from lxml.html import FormElement, HtmlElement, HTMLParser, SelectElement
File "E:\Anaconda3\lib\site-packages\lxml\html\__init__.py", line 53, in <module>
from .. import etree
ImportError: DLL load failed while importing etree: 找不到指定的模块。
同时我尝试在pycharm运行以前写的Scrapy项目都是没有问题的 非常奇怪
我根据提示 重新安装了lxml 和 etree并没有解决
后来看到一篇帖子 说环境变量不全导致 我按照步骤补全就解决了
需要配置的环境变量如下:
E:\Anaconda3
E:\Anaconda3\Scripts
E:\Anaconda3\Library\bin
E:\Anaconda3\Library\lib
其中 **E:\Anaconda3 ** 是我的anaconda根目录
网友评论