python – Scrapy:无法创建项目

我有问题安装scrapy方面的lxml,但后来我发现了一些关于*的信息.根据这些信息,我做了一个sudo easy_install lxml,有一些错误,我认为scrapy得到了安装:

我得出那个判断的原因是我击退了我可以做的事情:

Python 2.7.5 (default, Jul 28 2013, 07:27:04) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scrapy import *
>>> 

但是当我尝试做scrapy tutorial时,我得到以下错误:

$scrapy startproject tutorial
Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 4, in <module>
    import pkg_resources
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: lxml

解决方法:

根据这个thread

This problem can arise on Macs when you use pip to install some
packages and easy_install to install others.

尝试:

sudo easy_install --upgrade lxml 
sudo easy_install --upgrade scrapy
上一篇:python-使用xpath获取部分字符串匹配的html标签


下一篇:python-使用XPath 1.0提取文本与正则表达式匹配的URL