操作系统:
Mac os,版本:10.12.5,64bit Mysql:版本 5.7.18 Homebrew
使用 brew 安装了 mysql ( Server version: 5.7.18 Homebrew ) ,然后下载了 MySQLdb,正确安装尅没有报错,安装成功后报错,报错如下:
MySQL_python-1.2.5-py2.7.egg-info lazybone$ python -c "import MySQLdb"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so, 2): Symbol not found: _mysql_affected_rows
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so
尝试如下解决方案,均未果:
_mysql.so 相关信息:
MySQL_python-1.2.5-py2.7.egg-info lazybone$ file /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so
/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so: Mach-O universal binary with 2 architectures: [x86_64: Mach-O 64-bit bundle x86_64] [i386: Mach-O bundle i386]
/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.12-intel.egg/_mysql.so (for architecture i386): Mach-O bundle i386
ps:同样机器配置,同事可以安装并使用!!!( Mysql 5.7.18 Homebrew + MySQL_python-1.2.4b4 )
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.