我的 ruby 项目需要一些三方库,如 oj、recog 等。我使用 gem install 安装了对应包,显示成功,但是运行项目时依旧提示缺少相关包,gem llist 也没有找到。 搜索寻找后发现 gem install 的包在 - "gem" => "--install-dir=/opt/rh/rh-ruby30/root/usr/local/share/gems --bindir /opt/rh/rh-ruby30/root/usr/local/bin" ,即/opt/rh...目录下。 我是希望能将三方包导入到/usr/local/lib/ruby/gems/3.0.0/gems 的目录下的。我应该怎么做呢?或者可以改变 ruby 项目引用的三方库的路径吗?改成/opt/rh...? 我之前安装 ruby 遇到了麻烦,rbenv,yum install rh-ruby30 都做了尝试,最后选择了下载 gz 文件自己解压编译,之前的 yum 包我已经 remove 了,这会有影响吗? 恳求大家帮忙,配了好几天,快失去信心了...... 以下是 gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.2.33
- RUBY VERSION: 3.0.4 (2022-04-12 patchlevel 208) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/3.0.0
- USER INSTALLATION DIRECTORY: /root/.local/share/gem/ruby/3.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.local/share/gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/3.0.0
- /root/.local/share/gem/ruby/3.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.ruby-china.com/"]
- :concurrent_downloads => 8
- "gem" => "--install-dir=/opt/rh/rh-ruby30/root/usr/local/share/gems --bindir /opt/rh/rh-ruby30/root/usr/local/bin"
- REMOTE SOURCES:
- http://gems.ruby-china.com/
- SHELL PATH:
- /usr/local/java/jdk1.8.0_321/bin
- /opt/maven/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /root/bin