简体   繁体   English

如何构建和安装hcluster?

[英]How to build & install hcluster?

I download hcluster from http://pypi.python.org/pypi/hcluster , then unzip to a folder , then type "python setup.py install" . 我从http://pypi.python.org/pypi/hcluster下载hcluster,然后解压缩到一个文件夹,然后键入"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: 但是我尝试“导入hcluster”,它显示:

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 ? 我是构建,编译,安装Python模块等的新手,有人可以显示详细步骤来解决此问题吗? Thanks 谢谢

(I am using windows XP & Python 2.6.1 ) (我正在使用Windows XP和Python 2.6.1)

You are on windows, and are encountering a bug in distutils that prevents you from seeing the actual problem ): 您正在Windows上,并且在distutils中遇到一个错误,该错误使您无法看到实际的问题):

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

I suspect you will have something related to Visual Studio not installed. 我怀疑您将安装与Visual Studio相关的内容。 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). 如果您使用的是python 2.7,则需要安装VS 2008,然后重新运行setup.py。在python 3.x上,您需要更新的版本(但我不确定最新的版本是2010还是2012)。

Another, simpler solution is to install mingw, and do:: 另一个更简单的解决方案是安装mingw,然后执行以下操作:

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. 一个更简单的解决方案是检查所需的功能是否不在scipy.cluster中,该文件具有用于Windows的二进制安装程序。 Damian Eads (the writer of hcluster), contributed quite a bit to that module, and there is significant overlap. Damian Eads(hcluster的作者)对该模块做出了很大贡献,并且存在很多重叠之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM