【问题标题】:MySQL-Python with PyPy带有 PyPy 的 MySQL-Python
【发布时间】:2011-12-28 12:20:31
【问题描述】:

MySQL-Python (MySQLdb) 是 known to work with PyPy。您如何让它发挥作用?

我试过downloading it 并安装:

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 implementation,但是尝试使用它却给出了:

  ...
  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

我在这一点上不知所措。如何让它发挥作用

【问题讨论】:

  • 关于您的第一个错误:查看 mysqldb 的 site.cfg 和 setup.cfg 中的所有路径。其中一些具有不正确的默认值(Windows 32 位中存在“(x86)”、错误的路径等)。那个,或者mysql的版本不对。如果你让它工作,一定要让我知道据我所知,pypy + MySQLdb 仍然不能在 Windows 上开箱即用。

标签: installation mysql-python pypy


【解决方案1】:

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

ctypes.util.find_library('mysqlclient') 

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

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

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

【讨论】:

    【解决方案2】:

    你说得对,原来的 MySQLdb 已知不能在 PyPy 上运行。

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

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

    【讨论】:

    • 我试过你的叉子,不幸的是我得到了同样的错误。我试着用谷歌搜索这个libmysqlclient,但我没有发现任何有用的东西。
    【解决方案3】:

    使用pip 安装pypy 中的MySQLdb 包后,我没有遇到任何问题。

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

    一旦你安装了pip,它只是运行的问题

    pip install MySQL-python
    

    【讨论】:

      猜你喜欢
      • 2014-05-21
      • 1970-01-01
      • 2013-03-17
      • 2016-03-27
      • 1970-01-01
      • 1970-01-01
      • 2021-12-22
      • 2019-06-14
      • 1970-01-01
      相关资源
      最近更新 更多