mysql - virtualenv pip mysqldb mac os X python -
i tried http://jazstudios.blogspot.com/2010/07/installing-mysql-python-mysqldb-in.html tip install mysql-python (mysqldb) inside virtualenv (named dogme). (this post point out 2 important things :
export archflags="-arch x86_64" echo "mysql_config = /opt/local/bin/mysql_config5" >> ./dogme/build/mysql-python/site.cfg
to compile mysqldb)
but, when after, run python, import mysqldb, :
traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/.virtualenvs/dogme/lib/python2.5/site-packages/mysqldb/__init__.py", line 19, in <module> import _mysql importerror: dlopen(/home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so, 2): symbol not found: _mysql_affected_rows referenced from: /home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so expected in: flat namespace in /home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so
anyone understand what's wrong ?
i had similar problem, traceback:
>>> import mysqldb traceback (most recent call last): file "<stdin>", line 1, in <module> file "/library/python/2.6/site-packages/mysqldb/__init__.py", line 19, in <module> import _mysql importerror: dlopen(/library/python/2.6/site-packages/_mysql.so, 2): library not loaded: libmysqlclient.16.dylib referenced from: /library/python/2.6/site-packages/_mysql.so reason: image not found
what did put variables in .bash_profile
:
export dyld_library_path="/usr/local/mysql/lib/:$dyld_library_path"
and when ran python cgi application apache set same variable setenv directive:
<directory "/path/to/app"> setenv dyld_library_path /usr/local/mysql/lib/:$dyld_library_path ... </directory>
and working now.
Comments
Post a Comment