我正在根据这个网站学习GTK+3:https://python-gtk-3-tutorial.readthedocs.org/en/latest/install.html.从页面:
1.1.依赖
- GTK+3
- Python 2(2.6或更高版本)或Python 3(3.1或更高级别)
- gobject内省
[…]
从源代码安装PyGObject最简单的方法是使用JHBuild。它旨在轻松构建源程序包并发现依赖关系需要构建,以及构建顺序。为了设置JHBuild,请遵循JHBuild手册。
我按照这个链接遵循了手册,并通过gitJHBuild下载(正如他们所说的那样),并使用make/make-install构建了它。一切顺利。下一步是问题的开始。我按照页面运行了下一个命令:
2.3。构建先决条件
在构建任何模块之前,有必要进行一定的构建安装的工具。常见的构建工具包括GNU Autotools(autoconf、automake、libtool和gettext),GNU工具链(binutils、gcc、g++)、make、pkg config和Python,具体取决于将构建模块。
JHBuild可以使用卫生检查来检查工具是否已安装命令:
$ jhbuild sanitycheck
当我第一次运行这个时,我得到了这个:
jhbuild:无法创建安装前缀(/opt/gnome)
我运行了以下命令,得到了以下结果:
daddara@daddara-desktop:~/jhbuild/jhbuild$ sudo chmod 777 /opt/gnome/ -R
chmod: cannot access `/opt/gnome/': No such file or directory
daddara@daddara-desktop:~/jhbuild/jhbuild$ mkdir /opt/gnome
mkdir: cannot create directory `/opt/gnome': Permission denied
daddara@daddara-desktop:~/jhbuild/jhbuild$ jhbuild sanitycheck
jhbuild: install prefix (/opt/gnome) can not be created
daddara@daddara-desktop:~/jhbuild/jhbuild$ chmod 777 /opt/gnome/ -R
chmod: cannot access `/opt/gnome/': No such file or directory
daddara@daddara-desktop:~/jhbuild/jhbuild$ sudo chmod 777 /opt/gnome/ -R
chmod: cannot access `/opt/gnome/': No such file or directory
daddara@daddara-desktop:~/jhbuild/jhbuild$ jhbuild sanitycheck
jhbuild: install prefix (/opt/gnome) can not be created
daddara@daddara-desktop:~/jhbuild/jhbuild$ mkdir -p /opt/gnome
mkdir: cannot create directory `/opt/gnome': Permission denied
安装有什么问题?
您需要使用sudo mkdir
制作/opt/gnome
,然后使用sudo chmod
设置其权限。您忘记了mkdir
中的sudo
。
jhbuild对我来说也失败了,错误为:
jhbuild: install prefix (/opt/gnome) can not be created
在我的案例中,问题是我不小心在gnome图标主题模块中做了一个sudo make install
,所以这个命令创建了/opt/gnome
目录,并在其中安装了gnome图标的主题文件,然后后来我去了jhbuild run gedit
,出现了前面提到的错误,这是因为如果/opt/gnome
存在,jhbuild将自动使用它(为了向后兼容),如果不存在,则将使用推荐的方式使用~/jhbuild/install
,您可以在此处看到。
因此,在这种情况下,由于/opt/gnome
中唯一的文件是我通过sudo make install
命令意外安装的文件,因此解决方案只是删除该目录(例如,通过执行sudo rm -rf /opt/gnome
),然后,命令jhbuild run any-gnome-app
再次正常工作。
希望这个答案能帮助人们在谷歌上搜索(/opt/gnome) can not be created
错误。