没有名为kivy的模块

时间:2016-10-06 15:41:01

标签: python-2.7 kivy

我已经安装了kivy,kivy在/usr/lib/python2.7/dist-packages,但是当我在python shell中获得import kivy时,我得到了:

>>> import kivy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named kivy

当我再次运行sudo apt-get install python-kivy时:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-kivy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

发生了什么事?我有Debian 8.5。无法使用whereis, which

找到它
amir@amir-debian:~$ whereis kivy
kivy:
amir@amir-debian:~$ which python-kivy
amir@amir-debian:~$ whereis python-kivy
python-kivy:

它也没有显示在已加载的模块下:

import sys

print "*" * 30
for k in sys.modules:
        print "->", k
print "*" * 30

>>> ******************************
-> copy_reg
-> sre_compile
-> _sre
-> encodings
-> site
-> __builtin__
-> sysconfig
-> __main__
-> encodings.encodings
-> abc
-> posixpath
-> _weakrefset
-> errno
-> encodings.codecs
-> sre_constants
-> re
-> _abcoll
-> types
-> _codecs
-> _warnings
-> genericpath
-> stat
-> zipimport
-> encodings.__builtin__
-> warnings
-> UserDict
-> encodings.utf_8
-> sys
-> codecs
-> os.path
-> signal
-> traceback
-> linecache
-> posix
-> encodings.aliases
-> exceptions
-> sre_parse
-> os
-> _weakref
******************************

1 个答案:

答案 0 :(得分:1)

我很久没遇到这个问题了。我通过更改用于构建和运行代码的Python路径来修复它。该路径必须包含所有kivy文件的目录。