Python:MS Windows【PyCharm】安装【SCRAPY】报错:error: Microsoft Visual C++ 14.0 is required.
在MS Windows环境下使用PyCharm安装Python的scrapy的时候,你可能会遇到如下报错:
错误:
1. 【error: Microsoft Visual C++ 14.0 is required.】
2. 【Get it with “Microsoft Visual C++ Build Tools”:http://landinghub.visualstudio.com/visual-cpp-build-tools】
如果你跟着报错信息的提示,去访问网站【http://landinghub.visualstudio.com/visual-cpp-build-tools】希望获取【MIcrosoft Visual C++ Build Tools】,那你可能要失望了:
解法:
安装第三方的Python模块安装包:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
安装对应版本的Twisted。
在我的环境中:
1. MS Windows64
2. Python 3.7
因此我下载:
Twisted‑18.9.0‑cp37‑cp37m‑win_amd64.whl | https://download.lfd.uci.edu/pythonlibs/u2hcgva4/Twisted-18.9.0-cp37-cp37m-win_amd64.whl
下载完成后,命令行安装:
安装:Twisted
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 |
D:\PyCharm_data\Python_web_reptile>C:\Users\adamhuan\AppData\Local\Programs\Python\Python37\Scripts\pip.exe install D:\ 搜狗高速下载\Twisted-18.9.0-cp37-cp37m-win_amd64.whl Processing d:\搜狗高速下载\twisted-18.9.0-cp37-cp37m-win_amd64.whl Collecting incremental>=16.10.1 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/f5/1d/c98a587dc06e107115cf4a58b49de20b19222c83d75335a192052af4c4b7/incremental-17.5.0-py2.py3-none-any.whl Collecting hyperlink>=17.1.1 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/a7/b6/84d0c863ff81e8e7de87cff3bd8fd8f1054c227ce09af1b679a8b17a9274/hyperlink-18.0.0-py2.py3-none-any.whl Collecting Automat>=0.3.0 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/a3/86/14c16bb98a5a3542ed8fed5d74fb064a902de3bdd98d6584b34553353c45/Automat-0.7.0-py2.py3-none-any.whl Collecting zope.interface>=4.4.2 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/a8/d2/e2fb1052cdf1c1d05a23c5f7a192a8dc104d5afda0539f86b9839264e1cc/zope.interface-4.6.0-cp37-cp37m-win_amd64.whl (133kB) 100% |████████████████████████████████| 143kB 458kB/s Collecting constantly>=15.1 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/b9/65/48c1909d0c0aeae6c10213340ce682db01b48ea900a7d9fce7a7910ff318/constantly-15.1.0-py2.py3-none-any.whl Collecting PyHamcrest>=1.9.0 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/9a/d5/d37fd731b7d0e91afcc84577edeccf4638b4f9b82f5ffe2f8b62e2ddc609/PyHamcrest-1.9.0-py2.py3-none-any.whl (52kB) 100% |████████████████████████████████| 61kB 522kB/s Collecting attrs>=17.4.0 (from Twisted==18.9.0) Downloading https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl Collecting idna>=2.5 (from hyperlink>=17.1.1->Twisted==18.9.0) Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl Collecting six (from Automat>=0.3.0->Twisted==18.9.0) Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl Requirement already satisfied: setuptools in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from zope.interface>=4.4.2->Twisted==18.9.0) (39.0.1) Installing collected packages: incremental, idna, hyperlink, attrs, six, Automat, zope.interface, constantly, PyHamcrest, Twisted The script automat-visualize.exe is installed in 'c:\users\adamhuan\appdata\local\programs\python\python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. The scripts cftp.exe, ckeygen.exe, conch.exe, mailmail.exe, pyhtmlizer.exe, tkconch.exe, trial.exe, twist.exe and twistd.exe are installed in 'c:\users\adamhuan\appdata\local\programs\python\python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed Automat-0.7.0 PyHamcrest-1.9.0 Twisted-18.9.0 attrs-19.1.0 constantly-15.1.0 hyperlink-18.0.0 idna-2.8 incremental-17.5.0 six-1.12.0 zope.interface-4.6.0 You are using pip version 10.0.1, however version 19.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. D:\PyCharm_data\Python_web_reptile> |
以上:
1. 请忽略MS Windows中的CMD乱码的问题,该问题是因为我本地的WINDOWS的字符集偏差造成的,与当前问题的发生与解决均没有关联
安装: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 48 49 50 51 52 53 54 55 56 |
D:\PyCharm_data\Python_web_reptile>C:\Users\adamhuan\AppData\Local\Programs\Python\Python37\Scripts\pip.exe install scrapy Collecting scrapy Downloading https://files.pythonhosted.org/packages/3e/45/414e87ac8209d537c91575538c5307c20217a6943f555e0ee39f6db4bb0f/Scrapy-1.6.0-py2.py3-none-any.whl (231kB) 100% |████████████████████████████████| 235kB 35kB/s Collecting parsel>=1.5 (from scrapy) Downloading https://files.pythonhosted.org/packages/96/69/d1d5dba5e4fecd41ffd71345863ed36a45975812c06ba77798fc15db6a64/parsel-1.5.1-py2.py3-none-any.whl Requirement already satisfied: Twisted>=13.1.0 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from scrapy) (18.9.0) Collecting lxml (from scrapy) Downloading https://files.pythonhosted.org/packages/b8/5a/bb7f48b4e06ed60055c8bf2ea7d8259dae40a55dc03104cd7b0782699b9a/lxml-4.3.3-cp37-cp37m-win_amd64.whl (3.6MB) 100% |████████████████████████████████| 3.6MB 37kB/s Collecting w3lib>=1.17.0 (from scrapy) Downloading https://files.pythonhosted.org/packages/81/43/9dcf92a77f5f0afe4f4df2407d7289eea01368a08b64bda00dd318ca62a6/w3lib-1.20.0-py2.py3-none-any.whl Collecting PyDispatcher>=2.0.5 (from scrapy) Downloading https://files.pythonhosted.org/packages/cd/37/39aca520918ce1935bea9c356bcbb7ed7e52ad4e31bff9b943dfc8e7115b/PyDispatcher-2.0.5.tar.gz Requirement already satisfied: six>=1.5.2 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from scrapy) (1.12.0) Collecting queuelib (from scrapy) Downloading https://files.pythonhosted.org/packages/4c/85/ae64e9145f39dd6d14f8af3fa809a270ef3729f3b90b3c0cf5aa242ab0d4/queuelib-1.5.0-py2.py3-none-any.whl Collecting service-identity (from scrapy) Downloading https://files.pythonhosted.org/packages/e9/7c/2195b890023e098f9618d43ebc337d83c8b38d414326685339eb024db2f6/service_identity-18.1.0-py2.py3-none-any.whl Collecting pyOpenSSL (from scrapy) Downloading https://files.pythonhosted.org/packages/01/c8/ceb170d81bd3941cbeb9940fc6cc2ef2ca4288d0ca8929ea4db5905d904d/pyOpenSSL-19.0.0-py2.py3-none-any.whl (53kB) 100% |████████████████████████████████| 61kB 32kB/s Collecting cssselect>=0.9 (from scrapy) Downloading https://files.pythonhosted.org/packages/7b/44/25b7283e50585f0b4156960691d951b05d061abf4a714078393e51929b30/cssselect-1.0.3-py2.py3-none-any.whl Requirement already satisfied: constantly>=15.1 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (15.1.0) Requirement already satisfied: PyHamcrest>=1.9.0 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (1.9.0) Requirement already satisfied: Automat>=0.3.0 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (0.7.0) Requirement already satisfied: hyperlink>=17.1.1 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (18.0.0) Requirement already satisfied: incremental>=16.10.1 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (17.5.0) Requirement already satisfied: attrs>=17.4.0 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (19.1.0) Requirement already satisfied: zope.interface>=4.4.2 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from Twisted>=13.1.0->scrapy) (4.6.0) Collecting pyasn1-modules (from service-identity->scrapy) Downloading https://files.pythonhosted.org/packages/da/98/8ddd9fa4d84065926832bcf2255a2b69f1d03330aa4d1c49cc7317ac888e/pyasn1_modules-0.2.4-py2.py3-none-any.whl (66kB) 100% |████████████████████████████████| 71kB 31kB/s Collecting cryptography (from service-identity->scrapy) Using cached https://files.pythonhosted.org/packages/00/39/088ba8da28dd77582219d4b77263d5aedac37c5c1c31f75859f241b9fcd2/cryptography-2.6.1-cp37-cp37m-win_amd64.whl Collecting pyasn1 (from service-identity->scrapy) Using cached https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-any.whl Requirement already satisfied: setuptools in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from PyHamcrest>=1.9.0->Twisted>=13.1.0->scrapy) (39.0.1) Requirement already satisfied: idna>=2.5 in c:\users\adamhuan\appdata\local\programs\python\python37\lib\site-packages (from hyperlink>=17.1.1->Twisted>=13.1.0->scrapy) (2.8) Collecting cffi!=1.11.3,>=1.8 (from cryptography->service-identity->scrapy) Using cached https://files.pythonhosted.org/packages/18/dd/3936f31df9d4c6e07d7dbbee2bda3ebde49c20e0ff9364c753601cd4b4bd/cffi-1.12.2-cp37-cp37m-win_amd64.whl Collecting asn1crypto>=0.21.0 (from cryptography->service-identity->scrapy) Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service-identity->scrapy) Using cached https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz Installing collected packages: cssselect, lxml, w3lib, parsel, PyDispatcher, queuelib, pyasn1, pyasn1-modules, pycparser, cffi, asn1crypto, cryptography, service-identity, pyOpenSSL, scrapy Running setup.py install for PyDispatcher ... done Running setup.py install for pycparser ... done The script scrapy.exe is installed in 'c:\users\adamhuan\appdata\local\programs\python\python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed PyDispatcher-2.0.5 asn1crypto-0.24.0 cffi-1.12.2 cryptography-2.6.1 cssselect-1.0.3 lxml-4.3.3 parsel-1.5.1 pyOpenSSL-19.0.0 pyasn1-0.4.5 pyasn1-modules-0.2.4 pycparser-2.19 queuelib-1.5.0 scrapy-1.6.0 service-identity-18.1.0 w3lib-1.20.0 You are using pip version 10.0.1, however version 19.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. D:\PyCharm_data\Python_web_reptile> |
如上,解决后,再次在PyCharm中安装scrapy就没问题了:
————————
Done。