【original】安装Scrapy

November 26, 2013

1.参考:

http://scrapy.org/download/

去cmd中通过pip安装,结果出错:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 `E:Dev_ToolspythonScrapy>p``install``all Scrapy` `Downloading/unpacking Scrapy` `  ``Downloading Scrapy-0.16``tar``tar.gz (675kB): 675kB downloaded` `  ``Running setup.py egg_in``for``for package Scrapy` `    ``warning: no files found matchi``'license.txt'``xt' under directo``'scrapy'``py'` `    ``no previously-included directories found matchi``'docsbuild'``ld'` `Downloading/unpacking Twisted>=8.0 (from Scrapy)` `  ``Downloading Twisted-1``tar``.0.tar.bz2 (2.9MB): 2.9MB downloaded` `  ``Running setup.py egg``for``fo for package Twisted` `Downloading/unpacking w3lib>=1.2 (from Scrapy)` `  ``Downloading w``tar``b-1.2.tar.gz` `  ``Running setup.py ``for``_info for package w3lib` `Downloading/unpacking lxml (from Scrapy)` `  ``Downloading lx``tar``3.0.1.tar.gz (3.2MB): 3.2MB downloaded` `  ``Running setup.py ``for``_info for package lxml` `    ``Building lxml version 3.0.1.` `    ``Building without Cython.` `  ``'xslt-config'``t-config' 不是内部或外部命令,也不是可运行的程序` `    ``或批处理文件。``make`  `** make sure the development packages of libxml2 and libxslt are installed **` `    ``Using build configuration of libxslt` `    ``warning: no files found ``'lxml.etree.c'``.etree.c' under d``'srclxml'``srclxml'` `    ``warning: no files found ``'lxml.objectify.c'``ectify.c' under d``'srclxml'``srclxml'` `    ``warning: no files found ``'lxml.etree.h'``.etree.h' under d``'srclxml'``srclxml'` `    ``warning: no files found ``'lxml.etree_api.h'``ee_api.h' under d``'srclxml'``srclxml'` `    ``warning: no files found ``'etree_defs.h'``e_defs.h' under d``'srclxml'``srclxml'` `    ``warning: no files found ``'*.txt'``g '*.txt' under d``'srclxmltests'``mltests'` `    ``warning: no files found ``'pubkey.asc'``bkey.asc' under d``'doc'``ory 'doc'` `    ``warning: no files found ``'tagpython*.png'``hon*.png' under d``'doc'``ory 'doc'` `    ``warning: no files found ``'Makefile'``Makefile' under d``'doc'``ory 'doc'` `Downloading/unpacking pyOpenSSL (from Scrapy)` `  ``Downloading pyOpen``tar``-0.13.tar.gz (250kB): 250kB downloaded` `  ``Running setup.py ``for``_info for package pyOpenSSL` `    ``error: C``find` `'openssl.exe'``nssl.exe'` `    ``Complete out``command``m command python setup.py egg_info:` `    ``running egg_info` `creating pip-egg-infopyOpenSSL.egg-info` `writing pip-egg-infopyOpenSSL.egg-infoPKG-INFO` `top``iting top-level names to pip-egg-infopyOpenSSL.egg-infotop_level.txt` `writing dependency_links to pip-egg-infopyOpenSSL.egg-infodependency_links.txt` `writing ``file``f``'pip-egg-infopyOpenSSL.egg-infoSOURCES.txt'``RCES.txt'` `warning: manifest_maker: ``file``d``'-c'``file '-c' not found` `error: C``find` `'openssl.exe'``nssl.exe'` `----------------------------------------` `Command python setup.py egg_info failed with erro``in``code``users``c:usersadmini~1``local``atalocaltemppip-buildpyOpenSSL` `Storing comp``in``te log in C:UsersAdministratorpippip.log`

2。【已解决】安装Scrapy过程中出错:ERROR: ‘xslt-config’ 不是内部或外部命令,也不是可运行的程序 或批处理文件。

3.【已解决】安装Scrapy过程中出错:error: Could not find ‘openssl.exe’

4. 解决了openssl的问题,结果又出现

error: Unable to find vcvarsall.bat

的问题:

【已解决】安装Scrapy过程中出错:error: Unable to find vcvarsall.bat

5.最后终于安装成功:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 `E:Dev_ToolspythonScrapy>p``install``all Scrapy` `Requirement already satisfied (use --upgrade to upgrade): Scra``in` `in e:dev_install_rootpython27libsite-packages` `Requirement already satisfied (use --upgrade to upgrade): Twisted>``in``8.0 in e:dev_install_rootpython27libsite-packages` ` ``(from Scrapy)` `Downloading/unpacking w3lib>=1.2 (from Scrapy)` `  ``Running setup.py ``for``_info for package w3lib` `Requirement already satisfied (use --upgrade to upgrad``in``: lxml in e:dev_install_rootpython27libsite-packages (from S` `crapy)` `Requirement already satisfied (use --upgrade to upgrade): p``in``penSSL in e:dev_install_rootpython27libsite-packages (f` `rom Scrapy)` `Downloading/unpacking zope.interface (from Twisted>=8.0->Scrapy)` `  ``Running set``for``py egg_info for package zope.interface` `Requirement already satisfied (use --upgrade to upgrad``in``: distribute in e:dev_install_rootpython27libsite-packagesd` `istribute-0.6.28-py2.7.egg (from zope.interface->Twisted>=8.0->Scrapy)` `Installing collected packages: w3lib, zope.inter``install``R``for``ing setup.py install for w3``install``R``for``ing setup.py install for zope.``'zope.interface._zope_interface_coptimizations'``nterface_coptimizations' extension` `    ``********************************************************************************` `    ``WARNING:` `            ``An optional code optimization (C extension) could not be compiled.` `  ``for`       `Optimizations for this package will not be availabl``find`   `()` `    ``Unable to find vcvarsall.bat` `    ``********************************************************************************` `    ``Skipping installation of E:dev_install_rootPython27Libsite-packageszope__init__.py (namespace package)` `    ``Installing E:dev_install_rootPython27Libsite-packageszope.interface-4.0.1-py2.7-nspkg.pth` `Successfully installed w3lib zope.interface` `Cleaning up...`

6.然后再去参考:

Steps to install Scrapy

去测试安装是否成功:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 `Python ``2.7``.``2` `(default, Jun ``12` `2011``, ``14``:``24``:``46``) [MSC v.``1500` `64` `bit (AMD64)] on win32` `Type` `"copyright"``, ``"credits"` `or` `"license()"` `for` `more information.` `>>> ``import` `zope.interface` `>>> ``import` `twisted` `>>> ``import` `lxml` `>>> ``import` `OpenSSL` `Traceback (most recent call last):` `  ``File` `"<pyshell#3>"``, line ``1``, ``in` `<module>` `    ``import` `OpenSSL` `  ``File` `"E:dev_install_rootPython27libsite-packagesOpenSSL__init__.py"``, line ``13``, ``in` `<module>` `    ``from` `OpenSSL ``import` `crypto` `ImportError: DLL load failed: ``%``1` `不是有效的 Win32 应用程序。` `>>> ``import` `openssl` `Traceback (most recent call last):` `  ``File` `"<pyshell#4>"``, line ``1``, ``in` `<module>` `    ``import` `openssl` `ImportError: No module named openssl` `>>> ``import` `scrapy` `>>> ``print` `twisted.version` `[twisted, version ``10.2``.``0``]` `>>> ``print` `zope.version` `Traceback (most recent call last):` `  ``File` `"<pyshell#7>"``, line ``1``, ``in` `<module>` `    ``print` `zope.version` `AttributeError: ``'module'` `object` `has no attribute ``'version'` `>>> ``print` `lxml.version` `Traceback (most recent call last):` `  ``File` `"<pyshell#8>"``, line ``1``, ``in` `<module>` `    ``print` `lxml.version` `AttributeError: ``'module'` `object` `has no attribute ``'version'` `>>> ``print` `OpenSSL.version` `Traceback (most recent call last):` `  ``File` `"<pyshell#9>"``, line ``1``, ``in` `<module>` `    ``print` `OpenSSL.version` `NameError: name ``'OpenSSL'` `is` `not` `defined` `>>> ``print` `scrapy.version` `Traceback (most recent call last):` `  ``File` `"<pyshell#10>"``, line ``1``, ``in` `<module>` `    ``print` `scrapy.version` `AttributeError: ``'module'` `object` `has no attribute ``'version'` `>>>`

很明显,此处貌似OpenSSL好像没哟安装成功啊。

但是,前面的显示是:

Requirement already satisfied (use –upgrade to upgrade): pyOpenSSL in e:dev_install_rootpython27libsite-packages (from Scrapy)

说明是安装成功的才对啊。

先不管了,等以后遇到问题再说。

7.不过,后来参考了官网的安装教程:

http://doc.scrapy.org/en/latest/intro/install.html#intro-install

->

http://doc.scrapy.org/en/latest/intro/install.html#intro-install-platform-notes

Win32 OpenSSL page

下载

Visual C++ 2008 Redistributables (x64)

得到vcredist_x64.exe并安装。

再下载Win64 OpenSSL v1.0.0j得到Win64OpenSSL-1_0_0j.exe并安装。

期间竟然提示找不到VC++ 2008:

not found vc   2008

不过不管,继续安装至完毕。

然后把

E:dev_install_rootOpenSSL-Win64bin

添加到环境变量PATH中。

【总结】

想要安装Scrapy,但是其依赖一堆的其他库,而本身pip或者Easy_install时,又不难很好的自动解决这些依赖的库的问题(比如twisted,是twisted本身的问题),导致只是安装Scrapy,都这么麻烦。无语了。