尝试使用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.
任何帮助将不胜感激
您可能没有正确的路径变量设置。 Visual Studio构建工具会安装您需要运行的脚本,以便在外壳中获取正确的变量。]>
这是说,在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上运行良好,不需要编译器。