运行代码时出现python 3.6.3 kivy错误

时间:2018-02-07 01:46:51

标签: python visual-studio-code pycharm kivy

我刚刚使用python3版本3.6.3在ubuntu 17.10上安装了Kivy,当我试图通过运行此代码来检查kivy是否正常工作:

import kivy

from kivy.app import App
from kivy.uix.button import Button


class TestApp(App):

    def build(self):
        # return a Button() as a root widget
        return Button(text='hello world')


if __name__ == '__main__':
    TestApp().run()

我有这个错误(通过vscode终端):

Traceback (most recent call last):
  File "/home/pc/kivy.py", line 1, in <module>
    import kivy
  File "/home/pc/kivy.py", line 3, in <module>
    from kivy.app import App
ImportError: No module named app

和这个错误(通过pycharm):

Traceback (most recent call last):
  File "/home/pc/PycharmProjects/untitled/Kivy.py", line 1, in <module>
    import kivy
ModuleNotFoundError: No module named 'kivy'

Process finished with exit code 1

0 个答案:

没有答案