macosx 安装mysql_macosx安装mysqlmysql

在MacOSX上安装MySQL时遇到了两个问题:1. 在导入MySQLdb时出现ImportError,原因是_mysql模块找不到;2. _mysql.so库加载错误,提示libmysqlclient.18.dylib找不到合适架构。解决方法包括重新安装mysql-python,使用brew卸载和安装mysql,并确保安装的是通用版本。
摘要由CSDN通过智能技术生成

两天的折腾结果: 问题一: import MySQLdb Traceback (most recent call last): File stdin, line 1, in module File /Library/Python/2.7/

site-packages/MySQLdb/__init__.py, line 19, in module import _mysql ImportError: dlopen(/Library/Python/2.7/

两天的折腾结果:

问题一:import MySQLdb

Traceback (most recent call last):

File "", line 1, in

File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in

import _mysql

ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Symbol not found: _mysql_affected_rows

Referenced from: /Library/Python/2.7/site-packages/_mysql.so

Expected in: flat namespace

in /Library/Python/2.7/site-packages/_mysql.so

关闭mysql 重新安装mysql-python:

admin$:mysql.server stop

admin$:sudo pip uninstall MySQL-python

admin$:sudo pip install MySQL-python

问题二:Traceback (most recent call last):

...

import MySQLdb

File "/Users/cole/Library/Python/2.5/site-packages/MySQLdb/__init__.py", line 19, in

import _mysql

ImportError: dlopen(/Users/cole/Library/Python/2.5/site-packages/_mysql.so, 2): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib

Referenced from: /Users/cole/Library/Python/2.5/site-packages/_mysql.so

Reason: no suitable image found. Did find:

/usr/local/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture

/usr/local/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture

pip uninstall MySQL-python

brew uninstall mysql

brew install mysql --universal

pip install MySQL-python

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值