windows下安装python和mysql_Windows上的Python和MySQL:安装错误

我试图在Django项目的文件夹中运行以下命令:$ python manage.py dbshell

它显示了这个错误:$python manage.py dbshell

Traceback (most recent call last):

File "manage.py", line 11, in

execute_manager(settings)

File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line

362, in execute_manager

utility.execute()

File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line

303, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "C:\Python25\lib\site-packages\django\core\management\base.py", line 195,

in run_from_argv

self.execute(*args, **options.__dict__)

File "C:\Python25\lib\site-packages\django\core\management\base.py", line 222,

in execute

output = self.handle(*args, **options)

File "C:\Python25\lib\site-packages\django\core\management\base.py", line 351,

in handle

return self.handle_noargs(**options)

File "C:\Python25\lib\site-packages\django\core\management\commands\dbshell.py

", line 9, in handle_noargs

from django.db import connection

File "C:\Python25\lib\site-packages\django\db\__init__.py", line 41, in

e>

backend = load_backend(settings.DATABASE_ENGINE)

File "C:\Python25\lib\site-packages\django\db\__init__.py", line 17, in load_b

ackend

return import_module('.base', 'django.db.backends.%s' % backend_name)

File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line 35, in im

port_module

__import__(name)

File "C:\Python25\lib\site-packages\django\db\backends\mysql\base.py", line 13

, in

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No mo

dule named MySQLdb

第一个问题是,为什么Python不简单地包含这个MySQLdb模块?

好的,很好,尝试搜索以解决此消息。

我在stackoverflow.com上到处寻找安装这个模块的方法,但是没有得到一个好的结果。

在我的WindowsVista系统上安装此模块。

提取包后,我运行cmd提示符继续安装:$ python setup.py install

它再次向我展示了另一个信息:D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install

Traceback (most recent call last):

File "setup.py", line 5, in

from setuptools import setup, Extension

ImportError: No module named setuptools

在处理这个错误消息时,我知道包中存在ez_setup.py:$python ez_setup.py

似乎一切都很好:D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python ez_setup.py

Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py

2.5.egg

Processing setuptools-0.6c9-py2.5.egg

Copying setuptools-0.6c9-py2.5.egg to c:\python25\lib\site-packages

Adding setuptools 0.6c9 to easy-install.pth file

Installing easy_install-script.py script to C:\Python25\Scripts

Installing easy_install.exe script to C:\Python25\Scripts

Installing easy_install-2.5-script.py script to C:\Python25\Scripts

Installing easy_install-2.5.exe script to C:\Python25\Scripts

Installed c:\python25\lib\site-packages\setuptools-0.6c9-py2.5.egg

Processing dependencies for setuptools==0.6c9

Finished processing dependencies for setuptools==0.6c9

现在返回到setup.py重新安装:$python setup.py install

它又给了我一个错误信息:D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install

running install

running bdist_egg

....

copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.5\MySQLdb\constants

running build_ext

error: Python was built with Visual Studio 2003;

extensions must be built with a compiler than can generate compatible binaries.

Visual Studio 2003 was not found on this system. If you have Cygwin installed,

you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

我怎样才能解决这个问题?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值