1

众所周知, MySQL-Python (MySQLdb) 可以与 PyPy 一起使用如何让它发挥作用?

我尝试下载并安装:

C:\dev\Installs\MySQL-python\MySQL-python-1.2.3>pypy setup.py install
Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "C:\dev\Installs\MySQL-python\MySQL-python-1.2.3\setup_windows.py", line 7, in get_config
    serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified.

然后我尝试下载似乎已经安装好的ctypes 实现,但是尝试使用它给出了:

  ...
  File "C:\pypy-1.7\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: Can't find a libmysqlclient

我在这一点上不知所措。我如何使它工作

4

3 回答 3

2

关于 mysql-ctypes 的第二个错误,答案是该行

ctypes.util.find_library('mysqlclient') 

在 windows 上找不到库。将其更改为:

ctypes.util.find_library('mysqlclient.lib') 

在我的系统上工作 - 但这只会让你进入我系统上的下一个错误(Windows 错误 193)。

于 2013-02-10T08:54:25.830 回答
1

你是对的,原来的 MySQLdb 不能在 PyPy 上工作。

我从来没有尝试在 Windows 机器上安装 mysql-ctypes,因为我没有,但是你的 PATH 中安装了 libmysqlclient 吗?

如果是这样,您可以在https://github.com/EnTeQuAk/mysql-ctypes上尝试我的(遗憾的是尚未合并)fork,它支持更多版本的 libmysqlclient。

于 2011-12-28T14:19:37.140 回答
0

MySQLdb使用. _ pypy_pip

您可以在以下链接的第二部分找到安装说明pip: http: //doc.pypy.org/en/latest/getting-started.html#installing-pypypypy

安装pip后,只需运行即可

pip install MySQL-python
于 2014-05-26T01:29:51.173 回答