开发者

libmysqlclient15-dev on macs?

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 O开发者_如何学编程SX. Am I missing something here?


brew install mysql fixed this for me


I know this is old, but google got me here. So let's say the solution in 2018 for python3 on OSX.

brew install mysql-client echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile pip install mysqlclient


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


If you are using the mysql dmg file to install mysql you will need to edit your ~/.bash_profile and include this:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH


brew install mysql
then
arch -x86_64 gem install mysql2 -v 0.5.3 -- --srcdir=/usr/local/mysql/include
Afterwards I was able to run bundle install.

Copied from Bragadeesh Jegannathan's blog post


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.

On Mac OS X I recommend using MacPorts to manage the installation of these libraries/headers.


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.

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.

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.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜