0

尝试使用 pip 安装 fastai,但显示以下错误我已经安装了 Visual Studio 构建工具 2019,但仍然无法使用 pip 安装 fastai。

Installing collected packages: bottleneck, nvidia-ml-py3, fastai Running setup.py install for bottleneck ... error ERROR: Command errored out with exit status 1: command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\icarus\\AppData\\Local\\Temp\\pip-install-9snii33_\\bottleneck\\setup.py'"'"'; __file__='"'"'C:\\Users\\icarus\\AppData\\Local\\Temp\\pip-install-9snii33_\\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\icarus\AppData\Local\Temp\pip-record-bpmup82o\install-record.txt' --single-version-externally-managed --compile cwd: C:\Users\icarus\AppData\Local\Temp\pip-install-9snii33_\bottleneck\ Complete output (36 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.7 creating build\lib.win-amd64-3.7\bottleneck copying bottleneck\version.py -> build\lib.win-amd64-3.7\bottleneck copying bottleneck\__init__.py -> build\lib.win-amd64-3.7\bottleneck creating build\lib.win-amd64-3.7\bottleneck\benchmark copying bottleneck\benchmark\autotimeit.py -> build\lib.win-amd64-3.7\bottleneck\benchmark copying bottleneck\benchmark\bench.py -> build\lib.win-amd64-3.7\bottleneck\benchmark copying bottleneck\benchmark\bench_detailed.py -> build\lib.win-amd64-3.7\bottleneck\benchmark copying bottleneck\benchmark\__init__.py -> build\lib.win-amd64-3.7\bottleneck\benchmark creating build\lib.win-amd64-3.7\bottleneck\slow copying bottleneck\slow\move.py -> build\lib.win-amd64-3.7\bottleneck\slow copying bottleneck\slow\nonreduce.py -> build\lib.win-amd64-3.7\bottleneck\slow copying bottleneck\slow\nonreduce_axis.py -> build\lib.win-amd64-3.7\bottleneck\slow copying bottleneck\slow\reduce.py -> build\lib.win-amd64-3.7\bottleneck\slow copying bottleneck\slow\__init__.py -> build\lib.win-amd64-3.7\bottleneck\slow creating build\lib.win-amd64-3.7\bottleneck\src copying bottleneck\src\template.py -> build\lib.win-amd64-3.7\bottleneck\src copying bottleneck\src\__init__.py -> build\lib.win-amd64-3.7\bottleneck\src creating build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\input_modifcation_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\list_input_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\move_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\nonreduce_axis_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\nonreduce_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\reduce_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\scalar_input_test.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\util.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\tests\__init__.py -> build\lib.win-amd64-3.7\bottleneck\tests copying bottleneck\LICENSE -> build\lib.win-amd64-3.7\bottleneck running build_ext building 'bottleneck.reduce' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\icarus\\AppData\\Local\\Temp\\pip-install-9snii33_\\bottleneck\\setup.py'"'"'; __file__='"'"'C:\\Users\\icarus\\AppData\\Local\\Temp\\pip-install-9snii33_\\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\icarus\AppData\Local\Temp\pip-record-bpmup82o\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

任何形式的帮助将不胜感激

4

1 回答 1

1

您可能没有正确的路径变量设置。Visual Studio 构建工具安装脚本,您需要运行这些脚本才能在 shell 中获取正确的变量。

这就是说,在 Windows 上,除非您真的想编译自己的版本,否则我建议您使用 conda 安装它。

首先使用此处列出的 conda 命令安装 pytorch:https ://pytorch.org/get-started/locally/

如果您有 GPU:

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

如果使用 CPU:

conda install pytorch torchvision cpuonly -c pytorch

然后安装fastai:

conda install -c fastai fastai

此方法在 Windows 上运行良好,不需要编译器。

于 2019-10-04T16:13:53.287 回答