pip安装greenlet的时候,得到了以下提示:
Building wheels for collected packages: greenlet
Building wheel for greenlet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/bb/ppz02_zn03bcv85_f2k58rtr0000gp/T/pip-install-CbNfpB/greenlet/setup.py'"'"'; __file__='"'"'/private/var/folders/bb/ppz02_zn03bcv85_f2k58rtr0000gp/T/pip-install-CbNfpB/greenlet/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/bb/ppz02_zn03bcv85_f2k58rtr0000gp/T/pip-wheel-rc0XGE
cwd: /private/var/folders/bb/ppz02_zn03bcv85_f2k58rtr0000gp/T/pip-install-CbNfpB/greenlet/
Complete output (9 lines):
running bdist_wheel
running build
running build_ext
building 'greenlet' extension
creating build
creating build/temp.macosx-11.1-x86_64-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c greenlet.c -o build/temp.macosx-11.1-x86_64-2.7/greenlet.o
clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.1'
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Failed to build greenlet
得到其中的关键提示:
clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.1'
大意是clang的版本跟MACOX的版本不太对应,或许需要更新clang。
检查一下更新情况:
% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
https://mirrors.ustc.edu.cn/brew.git
With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/more/.
Warning: Suspicious https://github.com/Homebrew/homebrew-core git origin remote found.
The current git origin is:
https://mirrors.ustc.edu.cn/homebrew-core.git
With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/homebrew-core
Warning: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/more/.
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
其中有那么一个更新提示:
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Ok,那就根据提示,更新一下好了。
% softwareupdate --all --install --force
更新后,再次执行安装,问题即解决。