前言:装东西真的看运气,有时候自己环境对了,一下子就装上去了。如果环境不对,各种意想不到的问题,百度的时候,还没有一个准确答案,全靠自己摸着石头过河,瞎搞,哈哈。

一.目标,anaconda安装scrapy

二.问题

我用了三种方式装scrapy,前2种都没成功,最后一种终于成功。可以直接看第三种方法。

    1.我先用的Anaconda Navigator安装scrapy,装不上去,报错。

 

    UnsatisfiableSpecifications error

    Cause

    Some conda package installation specifications are impossible to satisfy. For example, conda create -n tmp python=3 wxpython=3 produces an "Unsatisfiable Specifications" error because wxPython 3 depends on     Python 2.7, so the specification to install Python 3 conflicts with the specification to install wxPython 3.

    When an unsatisfiable request is made to conda, conda shows a message such as this one:

    The following specifications were found to be in conflict:
    - python 3*
    - wxpython 3* -> python 2.7*
    Use "conda info <package>" to see the dependencies for each package.

    This indicates that the specification to install wxpython 3 depends on installing Python 2.7, which conflicts with the specification to install python 3.

    

    对这个问题,百度了n久,并没有满意答案。

    2.cmd输入conda install scrapy报错

    输入之后,也报错。

    UnsatisfiableError: The following specifications were found to be in conflict:
    - conda[version='>=4.6.12']
    - scrapy
    Use "conda search <package> --info" to see the dependencies for each package.

    报错,未解决。

    3.cmd输入pip install scrapy成功

       步骤:1.先打开cmd,输入pip install scrapy

          2.但是会报错,报错信息如下:

          building 'twisted.test.raiser' extension
          error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
          3.http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载twisted对应版本的whl文件,cp后面是python版本,amd64代表64位,
          运行命令:pip install C:\Users\Twisted-18.7.0-cp37-cp37m-win_amd64.whl      其中install后面为下载的whl文件的完整路径名

          4.安装完成后,再次运行:pip install Scrapy即可成功。

三、安装的时候最好添加清华镜像源,不然可能会报HTTP之类的错误。

    添加源的方法:1.在cmd下面输入 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

              继续输入conda config --set show_channel_urls yes

             2.到C:\Users\11590目录下(1159是我的微软账户名),找到.condarc文件,删去default源。

              效果图:

四、Anaconda重装我也试过,直接装也会出问题。

    1.最好在系统设置里面,程序与软件选项中卸载

    

    2.重启后,删除C:\Users\11590目录下(1159是我的微软账户名)这个目录下,

    

 

     3.最好换个文件夹重装。