美文网首页
Python 安装 Scrapy 简记

Python 安装 Scrapy 简记

作者: 且听风吟_aab8 | 来源:发表于2019-06-09 10:44 被阅读0次

    在Python环境构建好之后,通过命令:
    pip install scrapy
    可以直接安装scrapy,但是在安装过程中,会出现错误,其错误的核心提示为:

    uilding 'twisted.test.raiser' extension
        error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    
    

    错误产生原因是scrap有需要 Microsoft Visual C++ 14.0库的支持,这个问题的解决方式可以有两种:
    1.直接去微软官方下载对应的库,这种方式能从根本上解决一些列对 Microsoft 库依赖的问题,但是,安装包较大。
    2. 局部安装依赖,现在我们采取这种方式。
    具体步骤为:

    1. 检查本地python版本:
      python -version
      结果:
      Python 3.7.3
    2. 下载对应的依赖:
      https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
      其中,需要注意的是,根据检查到的python版本:
      Twisted-19.2.1-cp37-cp37m-win_amd64.whl
      其中:cp37,指的就是python 3.7:C Python 37
    3. 安装对应的库:
      pip install .\Twisted-19.2.1-cp37-cp37m-win_amd64.whl
    4. 重新安装scrapy:
      pip install scrapy
    5. 校验:
      scrapy version
      返回解结果为
      Scrapy 1.6.0
      表示安装成功

    相关文章

      网友评论

          本文标题:Python 安装 Scrapy 简记

          本文链接:https://www.haomeiwen.com/subject/fxpgxctx.html