Building wheel for Bottleneck (setup.py) ... error

【报错】Win10 CMD安装Bottleneck出现问题:

Building wheel for Bottleneck (setup.py) ... error

ERROR: running bdist_wheel

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: Failed building wheel for Bottleneck

完整报错信息见文末。 

 

【原因】win10的Microsoft Visual C++ Build Tools没装好,可能网上很多的答案都是让你去官网装个VS2017 VS2019之类的,因为免费,你可能装的是社区版(Visual Studio Community),但我想告诉你的是社区版不行,至少我装fastai所需的bottleneck的时候是这样的(你可以选择用Anaconda装fastai,可能不会遇到这个问题),需要装正式版的VS。我的安装列表如下:

1,VS 2019 Community(可能不需要装,未测试)(配置文件见附件1)

安装时勾选:使用C++的桌面开发,然后勾选其下的单个组件:Windows 10 SDK (10.0.17763.0)

Building wheel for Bottleneck (setup.py) ... error_第1张图片

 

2,VS 2019 (必须安装)(配置文件见附件2)

进入下载页面,选择所有下载,选择Visual Studio 2019 生成工具,点击下载按钮:

Building wheel for Bottleneck (setup.py) ... error_第2张图片

直接下载链接(可能失效):https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16#

会下载一个1M左右的vs_buildtools,然后双击这个可执行文件,自动开始VS 2019下载安装过程,安装时勾选:

使用C++的桌面开发,然后保持默认勾选的4个组件进行安装就好:

1)MSVC v142 -VS 2019 c++ x64/86...

2)Windows 10 SDK (10.0.17763.0) (为什么勾了两遍?我也不知道,因为我是分两次装的,可能第二次虽然勾了但没有重复安装?可能不勾也没事但我没有进行尝试)

3)用于Windows 的C++ CMAKE工具

4)测试工具核心功能 - 生成工具

Building wheel for Bottleneck (setup.py) ... error_第3张图片

 

注意:第一项 VS 2019 Community可能不需要装,未测试。
 

【解决】一开始只安装了VS 2019 Community (下的Windows 10 SDK (10.0.17763.0)组件)没有解决问题,后来在此基础上又安装了第二项 VS 2019,解决了。Bottleneck安装成功。(我是在Bottleneck官网下的Bottleneck-1.2.1.tar.gz软件包,然后使用以下命令解压、安装的)

# 在Windows CMD中操作

# 解压
tar -zxvf Bottleneck-1.2.1.tar.gz
# 进入解压目录
cd Bottleneck-1.2.1
# 安装
python setup.py install

【完整报错】

Building wheel for Bottleneck (setup.py) ... error
  ERROR: Complete output from command 'c:\users\lenovo\appdata\local\programs\python\python36\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-wl8w8ygs\\Bottleneck\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Lenovo\AppData\Local\Temp\pip-wheel-7os33oub' --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\bottleneck
  copying bottleneck\version.py -> build\lib.win-amd64-3.6\bottleneck
  copying bottleneck\__init__.py -> build\lib.win-amd64-3.6\bottleneck
  creating build\lib.win-amd64-3.6\bottleneck\benchmark
  copying bottleneck\benchmark\autotimeit.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
  copying bottleneck\benchmark\bench.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
  copying bottleneck\benchmark\bench_detailed.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
  copying bottleneck\benchmark\__init__.py -> build\lib.win-amd64-3.6\bottleneck\benchmark
  creating build\lib.win-amd64-3.6\bottleneck\slow
  copying bottleneck\slow\move.py -> build\lib.win-amd64-3.6\bottleneck\slow
  copying bottleneck\slow\nonreduce.py -> build\lib.win-amd64-3.6\bottleneck\slow
  copying bottleneck\slow\nonreduce_axis.py -> build\lib.win-amd64-3.6\bottleneck\slow
  copying bottleneck\slow\reduce.py -> build\lib.win-amd64-3.6\bottleneck\slow
  copying bottleneck\slow\__init__.py -> build\lib.win-amd64-3.6\bottleneck\slow
  creating build\lib.win-amd64-3.6\bottleneck\src
  copying bottleneck\src\template.py -> build\lib.win-amd64-3.6\bottleneck\src
  copying bottleneck\src\__init__.py -> build\lib.win-amd64-3.6\bottleneck\src
  creating build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\input_modifcation_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\list_input_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\move_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\nonreduce_axis_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\nonreduce_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\reduce_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\scalar_input_test.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\util.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\tests\__init__.py -> build\lib.win-amd64-3.6\bottleneck\tests
  copying bottleneck\LICENSE -> build\lib.win-amd64-3.6\bottleneck
  running build_ext
  building 'bottleneck.reduce' 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
  ----------------------------------------
  ERROR: Failed building wheel for Bottleneck
  Running setup.py clean for Bottleneck
Failed to build Bottleneck
Installing collected packages: Bottleneck
  Running setup.py install for Bottleneck ... error
    ERROR: Complete output from command 'c:\users\lenovo\appdata\local\programs\python\python36\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-wl8w8ygs\\Bottleneck\\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\Lenovo\AppData\Local\Temp\pip-record-p6c39zml\install-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    running build_ext
    building 'bottleneck.reduce' 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
    ----------------------------------------
ERROR: Command "'c:\users\lenovo\appdata\local\programs\python\python36\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-wl8w8ygs\\Bottleneck\\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\Lenovo\AppData\Local\Temp\pip-record-p6c39zml\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Lenovo\AppData\Local\Temp\pip-install-wl8w8ygs\Bottleneck\

 

【附件1】文件名:.vsconfig

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.Windows10SDK.17763",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.Workload.NativeDesktop"
  ]
}

【附件2】文件名 .vsconfig

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.CoreBuildTools",
    "Microsoft.VisualStudio.Workload.MSBuildTools",
    "Microsoft.VisualStudio.Component.Windows10SDK",
    "Microsoft.VisualStudio.Component.VC.CoreBuildTools",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.Component.Windows10SDK.17763",
    "Microsoft.VisualStudio.Component.VC.CMake.Project",
    "Microsoft.VisualStudio.Component.TestTools.BuildTools",
    "Microsoft.VisualStudio.Workload.VCTools"
  ]
}

 

你可能感兴趣的:(#,DL-报错,Python)