我最近将我的操作系统升级到 Ubuntu 20.04 LTS。
现在,当我尝试在 Python 中导入像 Numpy 这样的库时,出现以下错误:
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我尝试安装该libffi软件包,但 apt 找不到它:
sudo apt-get install libffi
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libffi
Run Code Online (Sandbox Code Playgroud) 这个问题现在困扰我几天......每当我使用.bring_to_front方法时
require "rubygems"
require "watir"
browser = Watir::Browser::new
browser.bring_to_front
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
(...)rubygems/custom_require.rb:36:in `require': no such file to load -- ffi_c (LoadError)
Run Code Online (Sandbox Code Playgroud)
我尝试卸载并重新安装ffi/watir/ruby/netbeans但没有成功.
第36行在custom_require.rb中
def require path
if Gem.unresolved_deps.empty? or Gem.loaded_path? path then
gem_original_require path
else
spec = Gem.searcher.find_active path
unless spec then
found_specs = Gem.searcher.find_in_unresolved path
unless found_specs.empty? then
found_specs = [found_specs.last]
else
found_specs = Gem.searcher.find_in_unresolved_tree path
end
found_specs.each do |found_spec|
Gem.activate_spec found_spec
end
end
return gem_original_require path #problem
end
Run Code Online (Sandbox Code Playgroud)
*本地宝石*
archive-tar-minitar (0.5.2)
builder (3.0.0)
childprocess (0.2.2)
columnize (0.3.4)
commonwatir (2.0.4) …Run Code Online (Sandbox Code Playgroud) 我想知道如何解决require在安装Ruby 2.2.1Windows 安装程序和Ruby gem 2.4.6.
LoadError: cannot load such file -- ffi_c
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_req
uire.rb:54:in `require'
Run Code Online (Sandbox Code Playgroud)
这是像DLL吗?
完整的堆栈跟踪:
/Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- ffi (LoadError)
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/sys-proctable-1.1.1-universal-darwin/lib/darwin/sys/proctable.rb:2:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/sys-proctable-1.1.1-universal-darwin/lib/sys-proctable.rb:1:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from /Users/galharth/Documents/productbattle/config/application.rb:7:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!' …Run Code Online (Sandbox Code Playgroud) 我从Rails 3.0.11升级到3.1.3.当我启动服务器时,它给出了错误:
>> Using rack adapter
rake aborted!
libffi.so.5: cannot open shared object file: No such file or directory - /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi_c.so
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `block in require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi.rb:11:in `rescue in <top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/lib/ffi.rb:2:in `<top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `block in require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/ethon-0.5.3/lib/ethon.rb:2:in `<top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `block in require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in `require' …Run Code Online (Sandbox Code Playgroud) Ruby 提出来LoadErrors我不明白。它抱怨打开共享对象文件(当它存在时)。
irb(main):001:0> require 'openssl'
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/openssl.rb:13:in `<top (required)>'
from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Run Code Online (Sandbox Code Playgroud)
但ls /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
返回文件/usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
加载路径:
irb(main):001:0> pp $LOAD_PATH
["/usr/lib/ruby/site_ruby/2.3.0",
"/usr/lib/ruby/site_ruby/2.3.0/x86_64-linux",
"/usr/lib/ruby/site_ruby",
"/usr/lib/ruby/vendor_ruby/2.3.0",
"/usr/lib/ruby/vendor_ruby/2.3.0/x86_64-linux",
"/usr/lib/ruby/vendor_ruby",
"/usr/lib/ruby/2.3.0",
"/usr/lib/ruby/2.3.0/x86_64-linux"]
Run Code Online (Sandbox Code Playgroud)
另一个例子,rails安装了 gem 后,生成新项目失败,并显示以下LoadError.
/usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': libcrypto.so.1.0.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/2.3.0/x86_64-linux/digest/md5.so (LoadError)
Run Code Online (Sandbox Code Playgroud)
再次,执行操作ls /usr/lib/ruby/2.3.0/x86_64-linux/digest/md5.so …
ruby ×4
bundle ×1
gem ×1
installation ×1
python ×1
ubuntu ×1
ubuntu-20.04 ×1
watir ×1
windows ×1