安装 mysql-python (Windows)

2021-11-20 00:00:00 python django mysql-python mysql

我花了几个小时试图让 Django 在我的电脑上运行.问题是我无法安装 mysql-python 包.我正在运行 Windows 7 64 位.这是我试过的:

I've spent hours trying to make Django work on my computer. The problem is that I can't install the mysql-python package. I'm running Windows 7 64bit. This is what I've tried:

  1. 我已经下载了easy_install
  2. 我已经下载了 Cygwin64 以便能够运行 Linux 命令(Win cmd 快把我逼疯了)
  3. 我输入了:easy_install mysql-python(给我一条错误消息,说它找不到 vcvarsall.bat)
  4. 我已经下载了 Visual Studio 2010.但是,我卸载了它,因为我发现我已经有了它的其他版本(它没有解决问题)

我已经在谷歌上搜索了这个问题一千次,所以如果有人能帮助我,我将不胜感激.提前致谢!

I have googled this problem like a thousand times, so I would be very grateful if someone could help me. Thanks in advance!

我发现了这个:https://pypi.python.org/pypi/MySQL-python/1.2.5.这是否意味着我不能用 python 3.3 运行 Django?如果那里有一个 .exe 文件,为什么还要费心去完成所有这些工作?

I discovered this: https://pypi.python.org/pypi/MySQL-python/1.2.5. Does this mean I can't run Django with python 3.3? And why bother to go through all this work if there is an .exe-file out there?

推荐答案

您将希望以这种方式将 Python 添加到您的路径环境变量中.前往:

You're going to want to add Python to your Path Environment Variable in this way. Go to:

  1. 我的电脑
  2. 系统属性
  3. 高级系统设置
  4. 在高级"标签下,点击环境变量"按钮
  5. 然后在系统变量下,您将要添加/更改以下变量:PYTHONPATHPath.这是我的变量外观的粘贴:
  1. My Computer
  2. System Properties
  3. Advance System Settings
  4. Under the "Advanced" tab click the button that says "Environment Variables"
  5. Then under System Variables you are going to want to add / change the following variables: PYTHONPATH and Path. Here is a paste of what my variables look like:

PYTHONPATH

C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts

路径

C:\Program Files\MySQL\MySQL Utilities 1.3.5\;C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts

你的路径可能不同,所以请调整它们,但这个配置对我有用,你应该能够在进行这些更改后运行 MySQL.

Your Path's might be different, so please adjust them, but this configuration works for me and you should be able to run MySQL after making these changes.

相关文章