解决pyenv dyld[1932]: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib

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 的版本吧,开发够用了。故以后不要用最新的版本,兼容性确实很差

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值