使用最近上传的kmodes包时出现以下问题:
https://pypi.python.org/pypi/kmodes/
运行用法示例:
import numpy as np
from kmodes import kmodes
data = np.random.choice(20, (100, 10))
km = kmodes.KModes(n_clusters=4, init='Huang', n_init=5, verbose=1)
print(km.cluster_centroids_)
clusters = km.fit_predict(data)
我收到的错误如下:
runfile('/Users/Amine/Documents/Python/Versuch1Kmodes07:06:2016.py', wdir='/Users/Amine/Documents/Python')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Amine/anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/Users/Amine/anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/Users/Amine/Documents/Python/Versuch1Kmodes07:06:2016.py", line 9, in <module>
from kmodes import kmodes
File "/Users/Amine/anaconda/lib/python3.5/site-packages/kmodes/kmodes.py", line 17, in <module>
from .util import get_max_value_key, encode_features
ImportError: No module named 'kmodes.util'
我不知道实际问题,因为我不了解错误的每一行。但.util
包是什么?我试图下载/安装它,但它不存在于互联网上。这是导致这个问题吗?