macos - 安装 PyGObject 时出错,找不到“glib-object.h”文件
问题描述
为了使用 gstreamer,我正在尝试在 pycharm 中为 python 2.7 安装 pygobject。但是我在安装它时遇到问题。在虚拟环境中,如果我使用
pip install pygobject
然后构建失败并给我这个错误
gi/gimodule.c:25:10: fatal error: 'glib-object.h' file not found
#include <glib-object.h>
^~~~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
我知道 glib 存在于我的系统上通过搜索它
find /usr -name glib-object.h
但由于某种原因,安装找不到它。我是否必须以某种方式链接它/我该怎么做?
另外我知道我可以更成功地将这个库与 python3 一起使用,但这会导致一些奇怪的系统错误,这些错误显然可以通过使用 2.7 来解决,所以我现在只是在探索。
解决方案
对于虚拟环境,建议PyGObject
使用pipenv
而不是pip
.
pipenv
使用或安装:MacPorts
_HomeBrew
pipsi
MacPorts
port install pipenv
家酿
brew install pipenv
皮普西
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
pipsi install pew
pipsi install pipenv
安装完成后,您pipenv
应该能够将包添加到您的虚拟环境中:
pipenv install pygobject
↳ PyGObject :创建开发环境
推荐阅读
- amazon-web-services - 从 AWS S3 下载的图像无法在任何查看器中正确打开
- flutter - LateInitializationError:字段“_selectedRadio@974458188”尚未初始化。无法解决此问题
- openshift - 使用 Redhat Developer 订阅创建 openshift 集群
- unit-testing - 如何测试需要令牌来调用数据服务的处理程序
- kubernetes - 我需要在普罗米修斯中发出磁盘使用警报
- angular - 有什么方法可以设置 ngx-chips 中使用的 tagModel 的值吗?
- python - 没有使用python数据框将数据写入文件的问题
- flutter - Flutter 在 Android 6 上崩溃:[ERROR:flutter/runtime/dart_vm_data.cc(18)] VM 快照无效,无法从设置中推断
- swift - 用正则表达式替换字符串
- python - 格式化数组的值以适合字典