开发者

Python 2.6 Django MYSQLDB error

开发者 https://www.devze.com 2023-03-14 22:42 出处:网络
Getting started with Django 1.3.1 and Upon running python manage.py syncdb with Python 2.6. I keep getting an error loading mysqldb module: No module named mysqldb message. I have tried doing sudo

Getting started with Django 1.3.1 and Upon running

python manage.py syncdb

with Python 2.6. I keep getting an error loading mysqldb module: No module named mysqldb message. I have tried doing sudo yum install python-mysql and sudo yum install python-mysqldb

on a CentOS 5 system but I get a "no package found" message and 开发者_高级运维the error persists in django.

What's the fix for this? I would like to keep the Python version as 2.6 to preserve other dependencies so reinstalling 2.5 or something is out of the question.

Thanks!


There's no point using the system packaging tools if you're using a different Python version to the one provided by the system. You'll have to use the Python packaging tools instead - eg easy_install mysqldb.


If you are just getting started with Django you should really take a look at virtualenv and pip.

This article gives a good overview: http://www.clemesha.org/blog/modern-python-hacker-tools-virtualenv-fabric-pip

You can even specify the python version for your virtual python environments.

And last but not least a good guide on how to get mysql running with virtualenv: http://www.saltycrane.com/blog/2010/02/install-mysqldb-virtualenv-ubuntu-karmic/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号