[英]No module named lxml.html
Running OS X 10.9.4, I'm trying to use Scrapy, but I get this error: 运行OS X 10.9.4,我正在尝试使用Scrapy,但出现此错误:
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 3, in <module>
from scrapy.cmdline import execute
File "/Library/Python/2.7/site-packages/scrapy/cmdline.py", line 8, in <module>
from scrapy.crawler import CrawlerProcess
File "/Library/Python/2.7/site-packages/scrapy/crawler.py", line 6, in <module>
from scrapy.core.engine import ExecutionEngine
File "/Library/Python/2.7/site-packages/scrapy/core/engine.py", line 14, in <module>
from scrapy.core.downloader import Downloader
File "/Library/Python/2.7/site-packages/scrapy/core/downloader/__init__.py", line 13, in <module>
from .middleware import DownloaderMiddlewareManager
File "/Library/Python/2.7/site-packages/scrapy/core/downloader/middleware.py", line 7, in <module>
from scrapy.http import Request, Response
File "/Library/Python/2.7/site-packages/scrapy/http/__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "/Library/Python/2.7/site-packages/scrapy/http/request/form.py", line 9, in <module>
import lxml.html
And 'pip install lxml' only returns 而“ pip install lxml”仅返回
/Users/username/.virtualenvs/scraper/lib/python2.7/site-packages
It seems like you installed scrapy
with system version of Python. 似乎您使用Python的系统版本安装了scrapy
。
While you installed lxml
in virtualenv version of Python. 在Python的virtualenv版本中安装lxml
时。
Check your pip
reference which python using following command: 使用以下命令检查您的pip
参考哪个python:
pip -V
If you want install scapy
in virtualenv, you need to uninstall scrapy
first. 如果要在virtualenv中安装scapy
,则需要先卸载scrapy
。 Otherwise it will prevent running of virtualenv version because of PATH issue. 否则,由于PATH问题,它将阻止运行virtualenv版本。
deactive # deactive first, to use system version of python/pip
pip uninstall -y scrapy
hash -r # refresh program location.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.