2017-08-06 298 views
2

當我嘗試在我的kali linux操作系統中使用python 3.5運行任何kivy程序時。然後我得到下面的錯誤。x11 - ImportError:沒有名爲'kivy.core.window.window_x11'的模塊

程序: -

from kivy.app import App 
from kivy.lang import Builder 
from kivy.uix.relativelayout import RelativeLayout 

Builder.load_string(''' 
<hey>: 
    RelativeLayout: 
     Button: 
      text:"Hey" 
''') 

class hey(RelativeLayout): 
    pass 

class helloApp(App): 
    def build(self): 
     return hey() 

if __name__=="__main__": 
    helloApp().run() 

錯誤: -

[INFO ] [OSC   ] using <multiprocessing> for socket 
[INFO ] [Window  ] Provider: sdl2(['window_egl_rpi'] ignored) 
[CRITICAL] [Window  ] Unable to find any valuable Window provider at all! 
egl_rpi - ImportError: cannot import name 'bcm' 
    File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib 
    fromlist=[modulename], level=0) 
    File "/usr/lib/python3/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module> 
    from kivy.lib.vidcore_lite import bcm, egl 

sdl2 - TypeError: expected bytes, str found 
    File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 67, in core_select_lib 
    cls = cls() 
    File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 138, in __init__ 
    super(WindowSDL, self).__init__() 
    File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 722, in __init__ 
    self.create_window() 
    File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 237, in create_window 
    self.fullscreen, resizable, state) 
    File "kivy/core/window/_window_sdl2.pyx", line 94, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:2204) 

x11 - ImportError: No module named 'kivy.core.window.window_x11' 
    File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib 
    fromlist=[modulename], level=0) 

[CRITICAL] [App   ] Unable to get a Window, abort. 

它曾經是做工精細當我安裝在前面的卡利Linux操作系統kivy但由於一些原因,我安裝了再次卡利和kivy再次,但這次我不能使它工作。

+1

解決它只是運行一個命令「PIP安裝的git +的https://github.com/kivy/[email protected]」在終端和它的工作對我來說 –

回答

0

我在ubuntu 17.04上看到了同樣的問題,也嘗試了大部分互聯網上的解決方案: [INFO] [Logger]記錄日誌/home/john/.kivy/logs/kivy_17-09-01_9.txt [INFO] [Kivy] v1.10.0 [INFO] [Python] v3.5.3 | Anaconda custom(64-bit)| (默認,2017年3月6日,11:58:13) [GCC 4.4.7 20120313(Red Hat 4.4.7-1)] [INFO] [出廠] 194個符號加載 [INFO] [Image] Providers:img_tex ,img_dds,img_pil,img_gif(img_sdl2,img_ffpyplayer忽略) [INFO] [Text] Provider:pil(['text_sdl2'] ignored) [CRITICAL] [Window]無法找到任何有價值的Window提供程序。 egl_rpi - 導入錯誤:在core_select_lib不能導入名稱 'BCM' 文件 「/home/john/anaconda3/lib/python3.5/site-packages/kivy/core/ 初始化 py」 爲59行, fromlist裏= [modulename],level = 0) 文件「/home/john/anaconda3/lib/python3.5/site-packages/kivy/core/window/window_egl_rpi.py」,第12行,來自kivy.lib.vidcore_lite的 import bcm,egl

sdl2 - ImportError:/home/john/anaconda3/lib/python3.5/site-packages/numexpr/../../../libstdc++.so.6:version`CXXABI_1。 3.9'找不到(需要/usr/lib/x86_64-linux-gnu/libmodplug.so.1) 文件「/home/john/anaconda3/lib/python3.5/site-packages/kivy/core/ in它是.py「,第59行,在core_select_lib中 fromlist = [modulename],level = 0) 文件」/home/john/anaconda3/lib/python3.5/site-packages/kivy/core/window/window_sdl2。 PY 「從kivy.core.window._window_sdl2進口_WindowSDL2Storage線26,在

X11 - 導入錯誤:沒有模塊名爲 'kivy.core.window.window_x11' 文件」/家/ JOHN/anaconda3/lib目錄/ python3.5 /站點包/ kivy /型芯/ 初始化 py」爲59行,在core_select_lib fromlist裏= [MODULENAME],水平= 0)

[CRITICAL] [應用]無法取得一個窗口,中止。

+0

我上面寫了一個解決方案,你試過了嗎? –

0

對我而言,這是一個過時的kivy版本。我看到你也在運行python3。除去kivy後,我做了這解決了我的問題如下:

sudo add-apt-repository ppa:kivy-team/kivy 
sudo apt-get update 
sudo apt-get install python3-kivy 
相關問題