virtualenv、mysql-python、pip:有人知道怎么做吗?

发布于 2024-08-06 17:29:52 字数 357 浏览 6 评论 0原文

我正在尝试在 virtualenv 中安装 mysql 绑定。我更喜欢使用 pip 或 easy_install。 pip 给我以下错误:

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

easy_install 要么从 sourceforge 获取 404,要么给我一个非常类似的错误。

有谁知道如何在 virtualenv 中解决这个问题?

I'm trying to install the mysql bindings in a virtualenv. I'd prefer to use pip or easy_install. pip gives me the following error:

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

easy_install either gets a 404 from sourceforge or gives me a very similar error.

Does anyone know how to get around this in a virtualenv?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

执手闯天涯 2024-08-13 17:29:52

我还尝试在 virtualenv 中设置 MySQL 绑定。我所要做的就是安装包含 mysql_config 的软件包。在 Ubuntu 上,它称为 libmysqlclient-dev

之后,我能够执行(virtualenv'd)python setup.py buildpython setup.py install

I'm also trying to setup MySQL bindings in a virtualenv. All I had to do was install the package that contains mysql_config. On Ubuntu it's called libmysqlclient-dev.

After that I was able to do a (virtualenv'd) python setup.py build and python setup.py install.

丢了幸福的猪 2024-08-13 17:29:52

在 OS XI 中,我使用 Macports 安装 MySQL,这使得 mysql_config 文件被称为 mysql_config5

所以我做了:
sudo ln -s mysql_config5 /opt/local/bin/mysql_config

然后从 virtualenv 运行 pip install MySQL-python 一切都很好。

In OS X I had used Macports to install my MySQL, which made the mysql_config file be called mysql_config5.

So I did:
sudo ln -s mysql_config5 /opt/local/bin/mysql_config

And then ran pip install MySQL-python from a virtualenv and all was fine.

不念旧人 2024-08-13 17:29:52

如果您没有安装适当的 mysqlclient-dev 操作系统软件包,您可能根本没有 mysql_config。

就我个人而言,对于需要大量 C 编译的软件包,我更喜欢安装操作系统打包的版本,因为这样我遇到的问题会更少。在我的所有服务器上安装操作系统打包版本的 mysql-python 比安装编译依赖项更容易。

幸运的是,根据我的经验,这些包也往往非常稳定(mysql-python、PIL、lxml 等),因此我不需要在每个项目中对它们进行版本固定。

然而,它确实阻止我使用 virtualenv --no-site-packages,这有点烦人。

You may not have mysql_config at all if you don't have the appropriate mysqlclient-dev OS package installed.

Personally, for packages that require extensive C compilation, I prefer to install OS-packaged versions, as I've had fewer problems that way. It's easier to install the OS-packaged version of mysql-python on all my servers than it is to install the compilation dependencies.

Fortunately in my experience those packages also tend to be very stable (mysql-python, PIL, lxml, etc), so I don't need to version-pin them per-project.

It does, however, prevent me from using virtualenv --no-site-packages, which is a little annoying.

乖乖 2024-08-13 17:29:52

找不到 mysql_config。将包含 mysql_config 的目录放在您的路径上,然后重试。

It is failing to find mysql_config. Put the directory containing mysql_config on your path and try again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文