如何在MySQL Workbench for Mac中添加系统路径(Big Sur)

qij5mzcb  于 2023-01-20  发布在  Mysql
关注(0)|答案(3)|浏览(276)

我使用的是 Catalina 操作系统和MySQL Workbench for Mac,它在我的旧iMac上运行得很好。但当我最近买了一台新的Mac,安装了大苏尔操作系统和MySQL Workbench时,它给了我以下导入错误:

Fatal Python error: initfsencoding: unable to load the file system codec, sys.path = ['/Applications/MySQLWorkbench.app/Contents/Resources/libraries', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload']
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000011ac12e00 (most recent call first):

我知道这是由于系统路径配置不当,因为我的python版本是3.8,所以我在bash_profile中添加了一个系统路径,如下所示:

export PYTHONPATH=~/Library/Python/3.8/lib/python/site-packages:$PYTHONPATH

export PATH=/usr/bin:$PATH

在python shell中得到的sys.path给了我以下信息:

Python 3.8.2 (default, Nov  4 2020, 21:23:28) 
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python38.zip', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/lib-dynload', '/Users/phillipkim/Library/Python/3.8/lib/python/site-packages', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages']

我找到了文件并重新启动了计算机。但是,当我尝试运行MySQL Workbench时,我得到了同样的错误消息。我找到了下面的website,它解释了在哪里更新MySQL Workbench的系统环境,但它只显示了Windows和Linux操作系统的示例。我如何为MySQL Workbench for Mac添加系统路径?非常感谢。

iugsix8n

iugsix8n1#

    • 问题**

Termination Reason: Namespace DYLD, 
Code 1 Library missing Library not loaded: 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Python' 
Referenced from: '/Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench' 
Reason: tried: '/System/Library/Frameworks/Python.framework/Versions/2.7/Python'
    • 解决方案**

here上解释的方法对我来说很有效,所以问题是python 2.7Mac 12.3中删除了,这影响了像Workbench这样的应用程序。
要使它们重新工作,您需要从官方下载link中下载Python 2.7.x,然后安装它,您的工具应该开始运行。

k4emjkb1

k4emjkb12#

我找到了以下解决方案:https://bugs.mysql.com/bug.php?id=102364
MySQLWorkbench需要在/Library/Frameworks/中使用Python 3.7框架
1.运行brew install python@3.7
1.然后,运行sudo cp -r /usr/local/Cellar/python@3.7/3.7.9_3/Frameworks/Python.framework /Library/Frameworks/Python.framework
1.最后,打开MySQLWorkbench,它就可以工作了。
或者您可以创建一个指向整个文件的符号链接(thx to@Phillip1982)
sudo ln -s /usr/local/Cellar/python@3.7/3.7.10_1/Frameworks/Python.framework /Library/Frameworks/Python.framework

tyu7yeag

tyu7yeag3#

我把macOS升级到Ventura后也遇到了同样的问题。我只需要下载最新的MYSQLWORKBENCH应用程序并重新安装到笔记本电脑上就可以修复这个错误

相关问题