gpt4 book ai didi

python - 适用于 Python 2.7 (Ubuntu) 的 MySQLdb

转载 作者:IT老高 更新时间:2023-10-29 00:00:07 26 4
gpt4 key购买 nike

安装MySQLdb后

sudo apt-get install python-mysqldb

我用Python 2.6的时候可以导入使用,2.7不行。 (ImportError: No module named MySQLdb)

我认为 apt-get install MySQLdb 在 2.6 版本中,但我不知道如何让 python 2.7 与它一起工作。请帮我。非常感谢!

最佳答案

如果你想在系统范围内安装 python2.7,你应该使用 easy_install-2.7。安装setuptools (或 distribute )对于 python 2.7,然后键入:

easy_install-2.7 mysql-python

更新:

或者只是

sudo apt-get install python2.7-mysqldb

请注意,如果不添加 sudo,您将无法进行更改。

关于python - 适用于 Python 2.7 (Ubuntu) 的 MySQLdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10062002/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com