rake db:mysql2 gem发生迁移错误-库未加载:libssl.1.0.0.dylib

时间:2018-07-10 11:39:18

标签: ruby-on-rails ruby rubygems rake mysql2

运行rake db:migrate后出现以下错误

rake aborted!
LoadError: dlopen(/Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle, 9): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
/Users/scott/Google Drive/playground/myApp/myApp/config/application.rb:21:in `<top (required)>'
/Users/scott/Google Drive/playground/myApp/myApp/Rakefile:4:in `<top (required)>'

libssl指的是什么?

6 个答案:

答案 0 :(得分:9)

首先卸载mysql2 gem:

gem uninstall mysql2

确保已安装openssl:

brew install openssl

它将打印一些注释。我们对此部分感兴趣:

For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

然后您可以像这样重新安装mysql2 gem:

gem install mysql2 -v 0.4.10 -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib

你应该很好。

答案 1 :(得分:3)

以下修复解决了问题

   ==> cd /usr/local/Cellar/openssl/1.0.2s/lib/

==> sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib

答案 2 :(得分:0)

因此,我自己的问题的答案如下:在5个以上stackoverflow解决方案中,这是唯一可行的解​​决方案:

brew install openssl

cd /usr/local/Cellar/openssl/1.0.1f/lib

sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/lib/

此处提供完整解决方案-https://mithun.co/hacks/library-not-loaded-libcrypto-1-0-0-dylib-issue-in-mac/

答案 3 :(得分:0)

就我而言,只是卸载并安装mysql2 gem可以达到目的

"value"
$ gem uninstall mysql2

答案 4 :(得分:0)

仅一个命令:

gem pristine mysql2

然后我解决此问题

答案 5 :(得分:0)

对于import pandas as pd df = pd.DataFrame({ 'A': ["x", "x", "y", "y"], 'B': [1, 2, 1, 1], }) df.drop_duplicates(subset=['A', 'B'], keep=False).drop_duplicates(subset=['A'])['A'] 的用户:

rbenv