MySQL mac上的libmysqlclient15-dev?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1857861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
libmysqlclient15-dev on macs?
提问by maccy1
Does OSX need an install of libmysqlclient15-dev? I'm trying to compile a gem that is failing and a lot of sources says to install "libmysqlclient15-dev" but I only see this for Linux, not OSX. Am I missing something here?
OSX 是否需要安装 libmysqlclient15-dev?我正在尝试编译一个失败的 gem,很多消息来源说要安装“libmysqlclient15-dev”,但我只在 Linux 上看到这个,而不是 OSX。我在这里错过了什么吗?
回答by Peter Ehrlich
brew install mysql
fixed this for me
brew install mysql
为我解决了这个问题
回答by edilio
I know this is old, but google got me here. So let's say the solution in 2018 for python3 on OSX.
我知道这很旧,但谷歌让我来到这里。所以让我们说一下 2018 年 OSX 上 python3 的解决方案。
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install mysqlclient
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install mysqlclient
回答by drhenner
If you are using the mysql dmg file to install mysql you will need to edit your ~/.bash_profile and include this:
如果您使用 mysql dmg 文件来安装 mysql,您将需要编辑您的 ~/.bash_profile 并包含以下内容:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
回答by Danny Mor
I just had the same problem and only got a partial working solution. Here are the steps I made to make it work:
我只是遇到了同样的问题,并且只得到了部分可行的解决方案。以下是我为使其工作而采取的步骤:
brew install mysql-client
brew install mysql-connector-c
IF YOU HAVE ZSH:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
ELSE:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Now for the installation itself:
LDFLAGS=-L<
your openssl lib folder location> pip install mysqlclient==<
version>
for example: LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient==1.3.12
brew install mysql-client
brew install mysql-connector-c
如果你有 ZSH:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
其他:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
现在安装本身:
LDFLAGS=-L<
您的 openssl lib 文件夹位置> pip install mysqlclient==<
版本>
例如:LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient==1.3.12
回答by rvelasquez
Yes you will need to install this. For example if you are trying to install the mysql gem you will need the headers for the mysql library. This is because some gems need to compile native extensions, so they need the header files for any 3rd party libraries that the extensions uses.
是的,您需要安装它。例如,如果您尝试安装 mysql gem,您将需要 mysql 库的头文件。这是因为一些 gem 需要编译本机扩展,因此它们需要扩展使用的任何 3rd 方库的头文件。
On Mac OS X I recommend using MacPorts to manage the installation of these libraries/headers.
在 Mac OS XI 上,建议使用 MacPorts 来管理这些库/头文件的安装。
回答by Warren Young
Those instructions are for Debian type Linuxes. The closest thing to Debian for OS X is Fink. After getting that installed and set up, you can say fink install mysql-unified-dev
to get essentially the same thing as asking for libmysqlclient15-dev
on a Debian or Ubuntu type system.
这些说明适用于 Debian 类型的 Linux。最接近 Debian for OS X 的是Fink。安装并设置好之后,您可以说fink install mysql-unified-dev
获得的内容与libmysqlclient15-dev
在 Debian 或 Ubuntu 类型系统上要求的内容基本相同。
Beware that Fink installs its packages in /sw
, and not all build scripts know to look there for libraries and headers. You might have to give custom build options to get it to figure this out.
请注意 Fink 将其软件包安装在/sw
. 您可能必须提供自定义构建选项才能解决这个问题。
A path that may be more successful is to simply download the MySQL 5.0 package for Mac OS X. That should include the same development files as libmysqlclient15-dev
, and as a bonus will put them in places more likely to be found by your gem.
一个可能更成功的途径是简单地下载适用于 Mac OS X的MySQL 5.0 包。这应该包括与 相同的开发文件libmysqlclient15-dev
,并且作为奖励会将它们放在更可能被您的 gem 找到的位置。
(Why 5.0, by the way? Because that's what corresponds to ABI version 15, which your package apparently requires. Maybe it will in fact work with 5.1, or 5.4, or 6.0, but that would be a risk you'd have to decide to take on your own.)
(顺便说一句,为什么是 5.0?因为这对应于 ABI 版本 15,您的包显然需要它。也许它实际上适用于 5.1、5.4 或 6.0,但这将是一个您必须决定的风险自己承担。)