欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools"

程序员文章站 2022-05-06 18:19:57
...

运行环境:
WIN10
python版本:3.6.5

经常使用linux的我,今天突然有需求使用win做一个小小的爬虫项目,但是在安装scrapy时出现了缺少C++库的报错。具体报错如下:

    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

提示内容大概是需要安装一个C++14.0的一个库,但是经过尝试链接却打不开。据有经验的大佬说是库文件非常之大,安装非常麻烦,遂到网上一番冲浪,寻到了一个更简单的安装集成包的方法可以跳过这个库的安装:
集成包下载地址:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

解决步骤:
1.首先打开https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted,找到对应版本的Twisted并下载到你的文件夹。在此我用的对应版本是:
Twisted-18.9.0-cp36-cp36m-win_amd64.whl

2.利用pip install命令安装指定存储路径下的whl文件。

pip install Twisted-18.9.0-cp36-cp36m-win_amd64.whl

一群代码狂奔而过之后结果如下 表示已经安装完成

D:\>pip install Twisted-18.9.0-cp36-cp36m-win_amd64.whl
Processing d:\twisted-18.9.0-cp36-cp36m-win_amd64.whl
Requirement already satisfied: Automat>=0.3.0 in c:\program files\python36\lib\site-packages (fro
m Twisted==18.9.0) (0.7.0)
Requirement already satisfied: hyperlink>=17.1.1 in c:\program files\python36\lib\site-packages (
from Twisted==18.9.0) (18.0.0)
Requirement already satisfied: PyHamcrest>=1.9.0 in c:\program files\python36\lib\site-packages (
from Twisted==18.9.0) (1.9.0)
Requirement already satisfied: incremental>=16.10.1 in c:\program files\python36\lib\site-package
s (from Twisted==18.9.0) (17.5.0)
Requirement already satisfied: attrs>=17.4.0 in c:\program files\python36\lib\site-packages (from
 Twisted==18.9.0) (18.2.0)
Requirement already satisfied: constantly>=15.1 in c:\program files\python36\lib\site-packages (f
rom Twisted==18.9.0) (15.1.0)
Requirement already satisfied: zope.interface>=4.4.2 in c:\program files\python36\lib\site-packag
es (from Twisted==18.9.0) (4.6.0)
Requirement already satisfied: six in c:\program files\python36\lib\site-packages (from Automat>=
0.3.0->Twisted==18.9.0) (1.11.0)
Requirement already satisfied: idna>=2.5 in c:\program files\python36\lib\site-packages (from hyp
erlink>=17.1.1->Twisted==18.9.0) (2.7)
Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages (from Py
Hamcrest>=1.9.0->Twisted==18.9.0) (28.8.0)
Installing collected packages: Twisted
Successfully installed Twisted-18.9.0

3.利用pip install 命令继续安装Scrapy

pip install scrapy

随后又是一群代码狂奔而过。代码过多就不复制粘贴了,但是,最后一行代码如下:表示安装scrapy成功

Successfully installed scrapy-1.5.1

然后完美解决问题。

相关标签: python scrapy