virtualenv pip mysqldb mac os X python
我尝试了这个 http://jazstudios.blogspot.com/ 2010/07/installing-mysql-python-mysqldb-in.html 提示在 virtualenv(名为 dogme)内安装 mysql-python (mysqldb)。 (这篇文章指出了两件重要的事情:
export ARCHFLAGS="-arch x86_64"
echo "mysql_config = /opt/local/bin/mysql_config5" >> ./dogme/build/MySQL-python/site.cfg
帮助编译 mysqldb)
但是,当我运行 python,导入 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
有人明白出了什么问题吗?
I tried this http://jazstudios.blogspot.com/2010/07/installing-mysql-python-mysqldb-in.html tip to install mysql-python (mysqldb) inside a 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 help compile mysqldb)
but, when after, i run python, import MySQLdb, I get this :
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的问题,请查看我的回溯:
我所做的是将这些变量放入我的
.bash_profile
中:当我使用 Apache 运行 Python CGI 应用程序时,我使用 SetEnv 指令设置了相同的变量
:现在一切正常。
I had a similar problem, look my traceback:
What I did was to put this variables in my
.bash_profile
:And when I ran a Python CGI application with Apache I set this same variable with SetEnv directive:
And everything is working now.