{"id":750,"date":"2009-09-01T12:21:32","date_gmt":"2009-09-01T16:21:32","guid":{"rendered":"http:\/\/cd34.com\/blog\/?p=750"},"modified":"2009-09-01T12:31:28","modified_gmt":"2009-09-01T16:31:28","slug":"mysql-python-and-snow-leopard","status":"publish","type":"post","link":"https:\/\/cd34.com\/blog\/programming\/python\/mysql-python-and-snow-leopard\/","title":{"rendered":"mysql-python and Snow Leopard"},"content":{"rendered":"<p>After the upgrade to Snow Leopard, mysql-python cannot be installed through easy_install.<\/p>\n<p>* Install <a href=\"http:\/\/dev.mysql.com\/downloads\/mysql\/5.1.html#downloads\">mysql&#8217;s x86_64<\/a> version from the .dmg file (I had a problem doing this when booted into the 64bit kernel, a 32bit kernel macbook had no problem)  With the 64bit kernel, the system reported &#8216;no mountable file systems&#8217; when trying to mount the .dmg file.  A reboot into 32bit mode allowed the .dmg to be mounted and installed.<br \/>\n* Change into your virtual environment if desired, source bin\/activate<br \/>\n* fetch <a href=\"http:\/\/sourceforge.net\/projects\/mysql-python\/\">MySQL-python-1.2.3c1<\/a><\/p>\n<pre>\r\ntar xzf MySQL-python-1.2.3c1.tar.gz\r\ncd MySQL-python-1.2.3c1\r\nARCHFLAGS='-arch x86_64' python setup.py build\r\nARCHFLAGS='-arch x86_64' python setup.py install\r\n<\/pre>\n<p>If everything works, you should see:<\/p>\n<pre>\r\n$ python\r\nPython 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) \r\n[GCC 4.2.1 (Apple Inc. build 5646)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import MySQLdb\r\n>>>\r\n<\/pre>\n<p>Some of the possible things you&#8217;ll encounter:<\/p>\n<p>After <strong>python setup.py build<\/strong>:<\/p>\n<pre>\r\nld: warning: in build\/temp.macosx-10.6-universal-2.6\/_mysql.o, file is not of required architecture\r\nld: warning: in \/usr\/local\/mysql\/lib\/libmysqlclient.dylib, file is not of required architecture\r\nld: warning: in \/usr\/local\/mysql\/lib\/libmygcc.a, file is not of required architecture\r\nld: warning: in build\/temp.macosx-10.6-universal-2.6\/_mysql.o, file is not of required architecture\r\nld: warning: in \/usr\/local\/mysql\/lib\/libmysqlclient.dylib, file is not of required architecture\r\nld: warning: in \/usr\/local\/mysql\/lib\/libmygcc.a, file is not of required architecture\r\n<\/pre>\n<p>This means that you have the i386 version of mysql installed.  Or, if you have the x86_64 version, you have didn&#8217;t include the proper ARCHFLAGS command.<\/p>\n<p><strong>ImportError: dynamic module does not define init function (init_mysql)<\/strong><\/p>\n<p>this means that the easy_install or the build\/install process was run which tried to build a ppc\/i386\/x86_64 combined build.<\/p>\n<p>If you see messages like:<\/p>\n<pre>\r\n$ python\r\nPython 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) \r\n[GCC 4.2.1 (Apple Inc. build 5646)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import MySQLdb\r\n\/Users\/xxxxx\/Python\/django\/lib\/python2.6\/site-packages\/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg\/_mysql.py:3: UserWarning: Module _mysql was already imported from \/Users\/xxxxx\/Python\/django\/lib\/python2.6\/site-packages\/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg\/_mysql.pyc, but \/Users\/xxxxx\/Python\/django\/MySQL-python-1.2.3c1 is being added to sys.path\r\n>>> \r\n<\/pre>\n<p>Then you are still in the build directory.  cd ..  and try again.<\/p>\n<div style=\"float:left;\">\n<div id=\"fb-root\"><\/div>\n<fb:like href=\"https:\/\/cd34.com\/blog\/programming\/python\/mysql-python-and-snow-leopard\/\" width=\"250\" send=\"false\" show_faces=\"false\" layout=\"button_count\" action=\"recommend\"><\/fb:like>\n<\/div><div style=\"clear:both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>After the upgrade to Snow Leopard, mysql-python cannot be installed through easy_install. * Install mysql&#8217;s x86_64 version from the .dmg file (I had a problem doing this when booted into the 64bit kernel, a 32bit kernel macbook had no problem) With the 64bit kernel, the system reported &#8216;no mountable file systems&#8217; when trying to mount [&hellip;]<\/p>\n<div style=\"float:left;\">\n<div id=\"fb-root\"><\/div>\n<fb:like href=\"https:\/\/cd34.com\/blog\/programming\/python\/mysql-python-and-snow-leopard\/\" width=\"250\" send=\"false\" show_faces=\"false\" layout=\"button_count\" action=\"recommend\"><\/fb:like>\n<\/div><div style=\"clear:both;\"><\/div>","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[72,70,71,73],"class_list":["post-750","post","type-post","status-publish","format-standard","hentry","category-python","tag-mac-osx","tag-mysql-python","tag-snow-leopard","tag-virtualenv"],"_links":{"self":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/comments?post=750"}],"version-history":[{"count":4,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/750\/revisions"}],"predecessor-version":[{"id":754,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/750\/revisions\/754"}],"wp:attachment":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/media?parent=750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/categories?post=750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/tags?post=750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}