gpt4 book ai didi

homebrew - 在 MacOS High Sierra 上通过 Homebrew 安装 Python 2 时出错

转载 作者:行者123 更新时间:2023-12-02 19:58:47 28 4
gpt4 key购买 nike

我在 MacOS High Sierra 上通过 Homebrew 软件安装 Python@2 时遇到问题。在 make 过程中,它多次失败,并出现“函数声明符错误后的预期函数体”。

根据 make 过程中的消息,它似乎与 High Sierra 上的命令行工具已更新到 MacOSX10.14.sdk 这一事实有关。现在的问题是如何将SDK降级到10.13?

clang -c -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Modules/main.o Modules/main.c
clang -c -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/gcmodule.o Modules/gcmodule.c
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/threadmodule.c -o Modules/threadmodule.o
In file included from Python/mactoolboxglue.c:27:
In file included from Include/pymactoolbox.h:10:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:24:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AppleEvents.h:597:165: error: expected function body after function declarator
extern OSStatus AEDeterminePermissionToAutomateTarget( const AEAddressDesc* target, AEEventClass theAEEventClass, AEEventID theAEEventID, Boolean askUserIfNeeded ) __OSX_AVAILABLE_STARTING( __MAC_10_14, __IPHONE_NA );
^
/usr/include/Availability.h:216:50: note: expanded from macro '__OSX_AVAILABLE_STARTING'
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
^
<scratch space>:95:1: note: expanded from here
__AVAILABILITY_INTERNAL__MAC_10_14
^
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/signalmodule.c -o Modules/signalmodule.o
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/errnomodule.c -o Modules/errnomodule.o
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/_sre.c -o Modules/_sre.o
In file included from Python/mactoolboxglue.c:27:
In file included from clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o
Include/pymactoolbox.h:10:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:67:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:200:51: error: expected ';' after top level declarator
typedef struct OpaqueInkTextRef* InkTextRef DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:222:53: error: expected ';' after top level declarator
typedef struct OpaqueInkStrokeRef* InkStrokeRef DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:251:49: error: expected ';' after top level declarator
typedef struct InkPoint InkPoint DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:252:52: error: expected ';' after top level declarator
typedef InkPoint * InkPointPtr DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:262:58: error: expected ';' after top level declarator
typedef CFIndex InkAlternateCount DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:274:63: error: expected ';' after top level declarator
typedef FourCharCode InkUserWritingModeType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:289:70: error: expected ';' after top level declarator
typedef FourCharCode InkApplicationWritingModeType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:303:34: error: expected ';' after top level declarator
typedef UInt32 InkDrawingModeType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:318:36: error: expected ';' after top level declarator
typedef UInt32 InkTextDrawFlagsType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:361:34: error: expected ';' after top level declarator
typedef UInt32 InkTerminationType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:427:29: error: expected ';' after top level declarator
typedef UInt32 InkSourceType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:454:34: error: expected ';' after top level declarator
typedef UInt32 InkRecognitionType DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:546:36: error: expected ';' after top level declarator
typedef FourCharCode InkGestureKind DEPRECATED_IN_MAC_OS_X_VERSION_10_14_AND_LATER;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:776:63: error: expected function body after function declarator
InkUserWritingMode(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_14;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:810:73: error: expected function body after function declarator
InkSetApplicationWritingMode(InkApplicationWritingModeType iWriteWhere) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_14;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:837:71: error: expected function body after function declarator
InkSetApplicationRecognitionMode(InkRecognitionType iRecognitionType) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_14;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:901:63: error: expected function body after function declarator
InkTerminationType iAllowedTerminationTypes) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_14;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/Ink.framework/Headers/Ink.h:934:63: error: expected function body after function declarator
InkIsPhraseInProgress(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_14;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/_weakref.c -o Modules/_weakref.o
20 errors generated.
make: *** [Python/mactoolboxglue.o] Error 1
make: *** Waiting for unfinished jobs....

我知道 MacOS 中安装了 Python,但这是我想通过 Homebrew 安装的两个工具的依赖项。

最佳答案

为了解决该问题,应分两步重新安装命令行工具:

  1. 删除命令行工具

sudo rm -rf /Library/Developer/CommandLineTools

  • 安装命令行工具
  • xcode-select --install

    新安装的版本会为 MacOSX10.13.sdk 和 MacOSX.14.sdk 这两个版本创建符号链接(symbolic link)。

    关于homebrew - 在 MacOS High Sierra 上通过 Homebrew 安装 Python 2 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52500880/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com