"brew install python3" kann pyexpat nicht kompilieren

brew install python3schlägt mit einem pyexpat-Fehler fehl, was bedeutet, dass das installierte Python XML nicht analysieren kann (brechen pipusw.). Hier der entsprechende Auszug aus ~/Library/Logs/Homebrew/python/02.make:

*** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-10.13-x86_64-3.7/pyexpat.cpython-37m-darwin.so, 2): Symbol not found: _XML_ErrorString
  Referenced from: build/lib.macosx-10.13-x86_64-3.7/pyexpat.cpython-37m-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-10.13-x86_64-3.7/pyexpat.cpython-37m-darwin.so

nm -gU /usr/lib/libexpat.1.dylibzeigt, dass dieses Symbol dort definiert ist, aber laut otool -Lder pyexpat- .soDatei wird es nicht erwähnt; seine einzige Abhängigkeit ist:

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

Nochmals von 02.make, so .sowurde das pyexpat erstellt (ich habe Zeilenumbrüche hinzugefügt, um es besser lesbar zu machen):

clang \
-bundle \
-undefined dynamic_lookup \
-isysroot \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk \
build/temp.macosx-10.13-x86_64-3.7/private/tmp/python-20180929-40812-11ki5rr/Python-3.7.0/Modules/pyexpat.o \
build/temp.macosx-10.13-x86_64-3.7/private/tmp/python-20180929-40812-11ki5rr/Python-3.7.0/Modules/expat/xmlparse.o \
build/temp.macosx-10.13-x86_64-3.7/private/tmp/python-20180929-40812-11ki5rr/Python-3.7.0/Modules/expat/xmlrole.o \
build/temp.macosx-10.13-x86_64-3.7/private/tmp/python-20180929-40812-11ki5rr/Python-3.7.0/Modules/expat/xmltok.o \
-L/usr/local/lib \
-o build/lib.macosx-10.13-x86_64-3.7/pyexpat.cpython-37m-darwin.so

Ich verwende XCode 9.4.1 auf Mac OS 10.13.6 (17G65). Andere Berichte weisen darauf hin, dass das Problem darin bestehen könnte, dass meine Xcode-Version neuer ist als meine macOS-Version, aber aufgrund von Arbeitsrichtlinien kann ich noch nicht auf Mojave upgraden.

Irgendwelche Ideen, wie ich eine funktionierende Python 3-Installation bekommen kann?

Antworten (1)

Ich habe das schließlich behoben, indem ich

  • XCode vollständig deinstallieren (und sich auf die xcode-select-Befehlszeilentools verlassen)
  • diesen Commit in mein Homebrew-Core Taps-Verzeichnis zu picken
  • python3 neu installieren
Der Commit-Link ist nicht mehr gültig
Es tut mir Leid; Ich wusste nicht, dass Git-Commit-Links gestorben sind :(