How to build & install hcluster?

房东的猫 提交于 2019-12-20 03:06:53

问题


I download hcluster from http://pypi.python.org/pypi/hcluster , then unzip to a folder , then type "python setup.py install" . It seems OK for it shows:

Z:\>python setup.py install
running install
running build
running build_py
running build_ext
building '_hierarchy_wrap' extension
error: None

But I try to "import hcluster" , it shows:

In [2]: import hcluster
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-002633efa200> in <module>()
----> 1 import hcluster

D:\Python\lib\site-packages\hcluster\__init__.py in <module>()
----> 1 import hierarchy as _h
      2 import distance as _d
      3 from hierarchy import *
      4 from distance import *
      5 from inspect import getmembers

D:\Python\lib\site-packages\hcluster\hierarchy.py in <module>()
    196
    197 import numpy as np
--> 198 import _hierarchy_wrap, types
    199 import hcluster.distance as distance
    200

ImportError: No module named _hierarchy_wrap

I am a newbie for building , compiling, installing etc for Python module, can someone show a detail step how to solve this issue ? Thanks

(I am using windows XP & Python 2.6.1 )


回答1:


You are on windows, and are encountering a bug in distutils that prevents you from seeing the actual problem ):

set DISTUTILS_DEBUG=1
python setup.py ....

I suspect you will have something related to Visual Studio not installed. If you are using python 2.7, you need to install VS 2008, and then rerun the setup.py On python 3.x, you need a more recent version (but I am not sure whether it is 2010 or 2012 for the latest).

Another, simpler solution is to install mingw, and do::

python setup.py build_ext -c mingw32

An even simpler solution would be to check whether the feature you need are not in scipy.cluster, which has a binary installer for windows. Damian Eads (the writer of hcluster), contributed quite a bit to that module, and there is significant overlap.



来源:https://stackoverflow.com/questions/14412518/how-to-build-install-hcluster

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!