安装Scrapy错误时出错:需要Microsoft Visual C ++ 14.0

时间:2017-04-14 10:06:44

标签: python scrapy

我发现scrapy是一个很好的工具,因此我尝试在我的机器上安装scrapy,但是当我尝试pip install scrapy时,它安装了一段时间并且把这个错误扔给了我..

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

我尝试在虚拟环境中安装它,但问题仍然存在。

编辑: 这是我在错误后得到的......

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "d:\pycharmprojects\environments\scrapyenv\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-arbeqlly\\Twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\User\AppData\Local\Temp\pip-jdj93131-record\install-record.txt --single-version-externally-managed --compile --install-headers d:\pycharmprojects\environments\scrapyenv\include\site\python3.5\Twisted" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-build-arbeqlly\Twisted\

任何帮助?

8 个答案:

答案 0 :(得分:8)

<强>更新 正如有人在编辑中指出的那样,如果你只下载vc_redist.x64.exe它只需要15MB,那就转到“其他工具和框架”并选择MS Visual C ++

通过安装here

中的工具解决了这个问题 事实上,有些python模块需要使用python包装器来编译C ++工具,因为它们是用C ++编写的。

下载设置后,您可以选择特定工具或下载提供的其他设施。

它大概是4 GB左右,但如果将来你需要使用其他一些用C ++编写的模块,那就解决了这个问题。

答案 1 :(得分:6)

使用Conda安装

如果您有conda,请使用:conda install -c anaconda scrapy

使用pip安装

在此位置下载Doctrine Form Elements docs 点安装Twisted-18.9.0-cp27-cp27m-win_amd64.whl pip install scrapy

答案 2 :(得分:2)

  

但问题是scrapy与visual studio有什么关系

某些python模块需要构建C / C ++编译器。这就是你需要Visual Studio的原因。

引自Scrapy Installation Guide

  

Scrapy所依赖的一些二进制包(如Twisted,lxml和   pyOpenSSL)需要一个可用于安装的编译器,如果你需要,则会失败   没有安装Visual Studio。

答案 3 :(得分:0)

我刚刚为C ++安装了Visual Studio桌面工具并解决了该问题。

答案 4 :(得分:0)

安装并使用anaconda(Python软件包管理器)而不是pip。

here下载anaconda,然后使用:

conda install scrapy

答案 5 :(得分:0)

您必须安装Python 2.7,然后将Python27和Pyhton27 / Scripts放在路径上,并安装Visual C ++ 14或更高版本,然后在cmd中键入In [57]: ax = sns.distplot(arr, hist=False, kde_kws={"shade": True}, norm_hist=True, label="density plot") In [58]: plt.plot(np.array([-0.208, -0.208]), np.array([0, 2]), color='grey', linestyle='--') In [59]: plt.plot(np.array([0.317, 0.317]), np.array([0, 2]), color='grey', linestyle='--') In [60]: ax.set_xlabel(r"similarity") In [61]: ax.set_ylabel(r"density") In [62]: plt.show()

答案 6 :(得分:0)

对我来说,仅安装“ vc_redist.x64.exe”无效。 我下载了Visual Studio 2019社区here,然后选择“ C ++桌面开发”,然后选择仅前两个框(请参见右侧的以下屏幕截图):

enter image description here

这对我有用。

答案 7 :(得分:-1)

只需安装Visual Studio构建工具即可解决问题。编码愉快!

相关问题