![Nvidia X 服务器 - 由于 python 导入错误,无法从我的英特尔切换到 GPU](https://linux22.com/image/992158/Nvidia%20X%20%E6%9C%8D%E5%8A%A1%E5%99%A8%20-%20%E7%94%B1%E4%BA%8E%20python%20%E5%AF%BC%E5%85%A5%E9%94%99%E8%AF%AF%EF%BC%8C%E6%97%A0%E6%B3%95%E4%BB%8E%E6%88%91%E7%9A%84%E8%8B%B1%E7%89%B9%E5%B0%94%E5%88%87%E6%8D%A2%E5%88%B0%20GPU.png)
当我尝试切换到 NVIDIA 时,发生了以下情况:
ERROR: Traceback (most recent call last):
File "/usr/share/screen-resolution-extra/nvidia-prime.py", line 22, in
<module>
import sys, dbus, logging
ImportError: No module named 'dbus'
如果有帮助的话,还有另一个错误:
** Message: PRIME: Requires offloading
** Message: PRIME: is it supported? yes
ERROR: nvidia-settings could not find the registry key file. This file should
have been installed along with this driver at
/usr/share/nvidia/nvidia-application-profiles-key-documentation. The
application profiles will continue to work, but values cannot be
prepopulated or validated, and will not be listed in the help text.
Please see the README for possible values and descriptions.
以及大量 gtk 主题解析错误。
我有 GT 635M GPU,并且正在运行安装了 gnome 桌面的 ubuntu 16.04 LTS。
请帮忙 :/
编辑 1:我尝试跑步
sudo apt-get install python-dbus
并得到
python-dbus is already the newest version (1.2.0-3).
切换 GPU 仍然会产生相同的错误。
编辑 2:我按照 Sneetsher 的建议编辑了 nvidia-prime.py。运行 nvidia-settings 不会打印 sys.version 和 sys.path,但如果我直接运行脚本,则会输出以下内容。
bp@ubuntu:~$ python /usr/share/screen-resolution-extra/nvidia-prime.py
2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413]
['/usr/share/screen-resolution-extra', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Usage: /usr/share/screen-resolution-extra/nvidia-prime.py nvidia|intel
答案1
我遇到了同样的错误。我通过运行sudo nvidia-settings
而不是 来修复它nvidia-settings
。这会增加启动应用程序所需的权限。
答案2
尝试使用终端切换 GPU。然后不会出现错误。
切换到 NVIDIA GPU:
sudo prime-select nvidia
切换到集成英特尔 GPU:
sudo prime-select intel
答案3
所以我终于解决了这个问题。我不得不安装最新的 nvidia 驱动程序 (367) 并在 UEFI 中禁用安全启动。突然它就正常工作了。