Apple a annoncé la sortie d'un Mac avec ARM en juin 2020 Il n'a pas encore été publié, mais il a en fait un impact. J'utilise pipenv pour l'environnement python, mais j'ai rencontré une erreur lors de la construction de cet environnement, alors j'en ai pris note.
macOS Catalina 10.15.7 Pipenv 2020.11.4
J'ai eu une erreur lors de l'installation de mysqlclient, mais le module que j'installe ne semble pas avoir grand-chose à voir avec ce problème.
$ pipenv install mysqlclient
Appuyer sur cette commande crachera un grand nombre d'erreurs et l'installation échouera. Regardant à l'intérieur de l'erreur,
[pipenv.exceptions.InstallError]: Complete output (120 lines):
[pipenv.exceptions.InstallError]: running install
[pipenv.exceptions.InstallError]: running build
[pipenv.exceptions.InstallError]: running build_py
[pipenv.exceptions.InstallError]: creating build
[pipenv.exceptions.InstallError]: creating build/lib.macosx-10.14.6-x86_64-3.8
[pipenv.exceptions.InstallError]: creating build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/connections.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/converters.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/cursors.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/release.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: copying MySQLdb/times.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: creating build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14.6-x86_64-3.8/MySQLdb/constants
[pipenv.exceptions.InstallError]: warning: build_py: byte-compiling is disabled, skipping.
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: building 'MySQLdb._mysql' extension
[pipenv.exceptions.InstallError]: creating build/temp.macosx-10.14.6-x86_64-3.8
[pipenv.exceptions.InstallError]: creating build/temp.macosx-10.14.6-x86_64-3.8/MySQLdb
[pipenv.exceptions.InstallError]: xcrun -sdk macosx clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/usr/local/opt/[email protected]/include -Dversion_info=(2,0,1,'final',0) -D__version__=2.0.1 -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.macosx-10.14.6-x86_64-3.8/MySQLdb/_mysql.o
[pipenv.exceptions.InstallError]: In file included from MySQLdb/_mysql.c:29:
[pipenv.exceptions.InstallError]: In file included from /usr/local/Cellar/mysql/8.0.22/include/mysql/mysql.h:45:
[pipenv.exceptions.InstallError]: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52:
[pipenv.exceptions.InstallError]: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:52:
[pipenv.exceptions.InstallError]: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:32:
[pipenv.exceptions.InstallError]: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
[pipenv.exceptions.InstallError]: #error Unsupported architecture
Et sortez.
Cette dernière «# error Architecture non prise en charge» est le miso, qui spécifie en fait l'architecture ARM lors de l'installation.
Par conséquent, vous pouvez spécifier l'architecture actuelle, x86_64
.
$ export ARCHFLAGS="-arch x86_64"
Faites ceci et refaites pipenv install mysqlclient
Les effets néfastes de devenir ARM proviennent d'un tel endroit.
Recommended Posts