问题现象:执行 python3 -m weditor 报错
➜ ~ python3 -m weditor
dyld[42143]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed
dyld[42143]: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Referenced from: <DB2A01C0-6DBB-DB93-EC82-117C736AC754> /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
Reason: tried: '/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation' (no such file), '/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation' (no such file, no dyld cache), '/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation' (no such file)
[1] 42143 abort python3 -m weditor
问题原因:多版本问题导致
解决方案:重新安装python、pip、weditor
1、安装brew
安装bew 或者自行搜搜
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
brew -v
入如果提示 gitxxx ,把提示的命名直接执行即可
eg:git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
eg:git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
2、brew 安装python3
brew install python3
安装过程中如果提示 brew link xxx warning,按照提示执行(版本冲突要覆盖)
eg:brew link --overwrite python@3.11
安装成功检查直接输入 python3,会显示版本好就好
3、安装pip
下载
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
安装python3 get-pip.py
检查是否安装成功pip -V
4、安装weditor
安装
python3 -m pip install weditor
5、运行weditor
python3 -m weditor
此时浏览器会打开http://localhost:17310/
参考文档
1、https://stackoverflow.com/questions/63089237/usr-local-bin-pip-bad-interpreter-usr-local-opt-python-bin-python3-7
2、http://events.jianshu.io/p/2e9e156bf897