我正在通过python3 -m pip install bottleneck
安装瓶颈。我的Python版本是3.7,系统是Mac OS。我遇到以下错误:
Building wheel for bottleneck (setup.py) ... error
和
error: command 'gcc' failed with exit status 1.
我已经安装了numpy
和wheel
软件包。
详细消息:
Collecting bottleneck
Using cached https://files.pythonhosted.org/packages/05/ae/cedf5323f398ab4e4ff92d6c431a3e1c6a186f9b41ab3e8258dff786a290/Bottleneck-1.2.1.tar.gz
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from bottleneck) (1.16.2)
Building wheels for collected packages: bottleneck
Building wheel for bottleneck (setup.py) ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/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 /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-wheel-6xd7l92k --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/bottleneck
copying bottleneck/version.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
copying bottleneck/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
copying bottleneck/benchmark/bench_detailed.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
copying bottleneck/benchmark/autotimeit.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
copying bottleneck/benchmark/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
copying bottleneck/benchmark/bench.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
copying bottleneck/slow/reduce.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
copying bottleneck/slow/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
copying bottleneck/slow/nonreduce.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
copying bottleneck/slow/move.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
copying bottleneck/slow/nonreduce_axis.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/nonreduce_axis_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/scalar_input_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/reduce_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/util.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/move_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/input_modifcation_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/nonreduce_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
copying bottleneck/tests/list_input_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
copying bottleneck/src/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
copying bottleneck/src/template.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
copying bottleneck/LICENSE -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
running build_ext
building 'bottleneck.reduce' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/bottleneck
creating build/temp.macosx-10.9-x86_64-3.7/bottleneck/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c bottleneck/src/reduce.c -o build/temp.macosx-10.9-x86_64-3.7/bottleneck/src/reduce.o -O2
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
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 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/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 /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-record-drpl_77t/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
running build_ext
building 'bottleneck.reduce' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/bottleneck
creating build/temp.macosx-10.9-x86_64-3.7/bottleneck/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c bottleneck/src/reduce.c -o build/temp.macosx-10.9-x86_64-3.7/bottleneck/src/reduce.o -O2
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/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 /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-record-drpl_77t/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/bottleneck/
您能告诉我如何解决该错误并安装软件包吗?
答案 0 :(得分:0)
问题似乎是这样的:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
似乎您没有安装Xcode命令行工具。
(您不需要安装Xcode,只需安装命令行工具即可。)
在安装瓶颈之前,请先尝试执行以下操作:
$ xcode-select --install
$ xcrun --version # just to check if it's installed
然后使用python3 -m pip install bottleneck
再试一次。
答案 1 :(得分:0)
问题是Xcode命令行工具需要更新。
返回您的终端:
xcode-select --install
然后您将收到:
xcode-select: note: install requested for command line developer tools
And be prompted in a window to update Xcode Command Line tools.
更新完成后,打开一个新的终端窗口,应返回您的开发工具。
添加:使用任何主要或半主要更新,您都需要更新命令行工具,以使它们再次正常运行。检查Xcode是否有任何更新。这超越了莫哈韦沙漠...
之后,重启终端
答案 2 :(得分:0)
解决此问题的另一种方法是下载Windows SDK 10(最新版本)。如果仅此方法不起作用,请下载Visual Studio 2019(同样以最新版本为准)。这将更新滚轮过程。