python 安装 Scrapy 报错(已解决)


安装参考:https://doc.scrapy.org/en/latest/intro/install.html#intro-install


本人通过:pip install Scrapy  安装

报以下错

\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\thing2-duplicate.pem -> build\lib
.win32-2.7\twisted\internet\test\fake_CAs
    copying src\twisted\internet\test\fake_CAs\thing2.pem -> build\lib.win32-2.7
\twisted\internet\test\fake_CAs
    copying src\twisted\mail\test\rfc822.message -> build\lib.win32-2.7\twisted\
mail\test
    copying src\twisted\words\im\instancemessenger.glade -> build\lib.win32-2.7\
twisted\words\im
    copying src\twisted\words\xish\xpathparser.g -> build\lib.win32-2.7\twisted\
words\xish
    running build_ext
    error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27


    ----------------------------------------
Command "d:\python\python27\python.exe -u -c "import setuptools, tokenize;__file
__='c:\\users\\admini~1\\appdata\\local\\temp\\pip-build-9gywq7\\Twisted\\setup.
py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\
n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\a
dmini~1\appdata\local\temp\pip-_jok3e-record\install-record.txt --single-version
-externally-managed --compile" failed with error code 1 in c:\users\admini~1\app
data\local\temp\pip-build-9gywq7\Twisted\


解决方法

(1)、先安装:twisted

(2)、下载地址:https://pypi.python.org/simple/twisted,下载了Twisted-15.0.0.win32-py2.7.exe(Twisted 14.0 以上版本即可)

(3)、然后再使用:pip install Scrapy

安装成功!如下图:

python 安装 Scrapy 报错(已解决)


【总结】

通常情况,安装使用 pip install Scrapy 即可完成。