问题描述
在 brew 升级后,我无法再运行任何 Ruby on Rails 应用程序.我收到此错误消息:
After a brew upgrade, I couldn’t run any of my Ruby on Rails apps anymore. I got this error message:
: dlopen(/Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundle, 9): 库未加载:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)引用自:/Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundle原因:找不到图像 -/Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundle
: dlopen(/Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)Referenced from: /Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundleReason: image not found - /Users/ll/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/openssl.bundle
所以我试过了
brew 开关 openssl 1.0.2t
brew switch openssl 1.0.2t
此处提供解决方案https://stackoverflow.com/a/59184347/11410556但是找不到openssl 1.0.2t,我的版本是openssl@1.1 1.1.1h
solution sugests here https://stackoverflow.com/a/59184347/11410556But couldn't find openssl 1.0.2t, my version was openssl@1.1 1.1.1h
- 然后我尝试了
brew uninstall --ignore-dependencies opensslbrew tap-new $USER/old-opensslbrew extract --version=1.0.2t openssl $USER/old-opensslbrew 安装 openssl@1.0.2tln -s/usr/local/Cellar/openssl@1.0.2t/1.0.2t/usr/local/opt/openssl
brew uninstall --ignore-dependencies opensslbrew tap-new $USER/old-opensslbrew extract --version=1.0.2t openssl $USER/old-opensslbrew install openssl@1.0.2tln -s /usr/local/Cellar/openssl@1.0.2t/1.0.2t /usr/local/opt/openssl
在这里建议:https://stackoverflow.com/a/64479513/11410556.但是当我跑了
suggest here: https://stackoverflow.com/a/64479513/11410556.But when I ran
brew 开关 openssl 1.0.2t
brew switch openssl 1.0.2t
我收到此错误:
openssl does not have a version "1.0.2t" in the Cellar.
openssl’s installed versions
所以我选择了这个解决方案
So I went for this solution
brew unlink openssl@1.1酿造链接 openssl@1.0.2t
brew unlink openssl@1.1brew link openssl@1.0.2t
然后得到:
Warning: Refusing to link macOS provided/shadowed software: openssl@1.0.2t
If you need to have openssl@1.0.2t first in your PATH run:
echo ‘export PATH="/usr/local/opt/openssl@1.0.2t/bin:$PATH"’ >> ~/.zshrc
For compilers to find openssl@1.0.2t you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.0.2t/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0.2t/include"
For pkg-config to find openssl@1.0.2t you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0.2t/lib/pkgconfig"
我跑了第一选择:
I ran the first choice :
echo 'export PATH="/usr/local/opt/openssl@1.0.2t/bin:$PATH"'>>~/.zshrc
echo 'export PATH="/usr/local/opt/openssl@1.0.2t/bin:$PATH"' >> ~/.zshrc
重启我的服务器,现在我有
restart my server and now I have
omz_urlencode:2: /usr/local/bin/pygmentize: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory (edited)
无论我做什么.
- 我不习惯尝试我不明白的事情,而且我认为我做得太过分了.如果您能帮助我摆脱困境,我将不胜感激.
推荐答案
对于那些有同样问题的人,这是我最终解决的方法.
For those who would have the same problem, here's how I finally fixed it.
关于 Python2 错误消息,我将 Python3 设置为默认 Python:
Regarding the Python2 error message, I set Python3 as a default Python with :
ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python
如此处建议:https://dev.to/malwarebo/how-to-set-python3-as-a-default-python-version-on-mac-4jjf
错误信息消失了.
关于 openssl 问题:
Regarding the openssl problem:
我使用 rbenv 安装了最新的 ruby 版本 2.7.2,并升级了我的应用程序.然后我有一个 PG::ConnectionBad 错误.
I installed the last ruby version 2.7.2 with rbenv, and upgraded my app.Then I had a PG::ConnectionBad error.
我跑了
brew postgresql-upgrade-database.
现在我工作正常.
建议的简单解决方案这里 让我先走.
The simple solution suggested here put me on the way.
感谢 anothermh 的支持.
Thanks anothermh for your support.
这篇关于试图解决/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) 导致错误的解释器:/usr/local/opt/python/bin/python2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!