前言:裝東西真的看運氣,有時候自己環境對了,一下子就裝上去了。如果環境不對,各種意想不到的問題,百度的時候,還沒有一個准確答案,全靠自己摸着石頭過河,瞎搞,哈哈。
一.目標,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
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.最好換個文件夾重裝。