【问题标题】:"ImportError: Failed to load GLFW3 shared library" without root access on Linux“ImportError: Failed to load GLFW3 shared library”在 Linux 上没有 root 访问权限
【发布时间】:2019-01-25 20:50:36
【问题描述】:

我正在尝试在我没有 root 访问权限的远程计算机上运行在 GitHub 上找到的 Python3 代码。该代码需要导入 glfw 依赖项。

虽然pip3 install --user glfw 似乎工作得很好(就像所有其他 python 依赖项一样),但当我尝试运行我得到的代码时:

Traceback(最近一次调用最后一次): 文件“”,第 1 行,在 文件“/home/ismarou/.local/lib/python3.5/site-packages/glfw/init.py”,第 34 行,在 raise ImportError("加载 GLFW3 共享库失败。") ImportError: 未能加载 GLFW3 共享库。

有什么我错过的吗?

【问题讨论】:

    标签: python shared-libraries importerror glfw


    【解决方案1】:

    您需要为 glfw3 安装 glfw3 和 python 绑定。使用pip install --user glfw,您只安装了绑定。现在你必须在你的系统上安装 glfw3。

    我在 Ubuntu 18.04 上遇到了同样的问题。安装libglfw3libglfw3-dev 解决了。

    sudo apt-get install libglfw3
    sudo apt-get install libglfw3-dev
    

    【讨论】:

    • 由于某种原因在我的设置中 python 仍然找不到 glfw 共享库。我检查它是否可以通过环境变量PYGLFW_LIBRARY 获取它并将变量导出到路径:set -x PYGLFW_LIBRARY /usr/lib/i386-linux-gnu/libglfw.so(在鱼壳中)。它有效。
    【解决方案2】:

    帮助pip3 install glfw在构建项目的同一目录下

    enter image description here

    【讨论】:

    • 你能解释一下你的答案吗?如何解决问题?它与其他答案有何不同?
    猜你喜欢
    • 2023-03-23
    • 2015-09-01
    • 1970-01-01
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 1970-01-01
    相关资源
    最近更新 更多