python
dyld[1932]: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
Referenced from: <2AEF083D-D145-3B9C-A5EE-7581368AAE2F> /Users/xxx/.pyenv/versions/3.9.0/bin/python3.9
Reason: tried: '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file, not in dyld cache)
zsh: abort python
Mac 电脑换到M3的芯片后,以前的python3.9.0版本都启动不了了,报错信息如上。
用brew 安装了gettext后(加了环境变量:export PATH=“/opt/homebrew/Cellar/gettext/0.22.5/bin:$PATH”),仍然报错如旧。但是python2的版本还是可以使用的。
主要还是M3的芯片太新了,然后 我安装了最新的python版本 3.12.2,就成功了,应该是兼容了M3芯片了。
也有以下做法:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/usr/local/Homebrew/bin/brew install pyenv
/usr/local/Homebrew/bin/brew link pyenv
arch -x86_64 pyenv install 3.7.0
还是报错了
arch -x86_64 pyenv install 3.7.0
python-build: use openssl from homebrew
python-build: use readline from homebrew
Installing Python-3.7.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 14.3 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/qc/614hn1lj1yq534r0pvk0m3p40000gp/T/python-build.20240607135619.80526
Results logged to /var/folders/qc/614hn1lj1yq534r0pvk0m3p40000gp/T/python-build.20240607135619.80526.log
Last 10 log lines:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach-o/dyld.h:105:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
^
./Modules/posixmodule.c:8401:15: error: call to undeclared function 'sendfile'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
这个办法不行。所以 就用 python 3.12.2 的版本吧,开发够用了。故以后不要用最新的版本,兼容性确实很差