python - 如何构建和安装hcluster?

标签 python hcluster

我从http://pypi.python.org/pypi/hcluster下载hcluster ,然后解压到一个文件夹,然后输入 "python setup.py install" 。看起来没问题,因为它显示:

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

但我尝试“导入 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

我是Python模块构建、编译、安装等方面的新手,有人可以展示如何解决这个问题的详细步骤吗?谢谢

(我使用的是 Windows XP 和 Python 2.6.1)

最佳答案

您在 Windows 上,并且在 distutils 中遇到一个错误,该错误使您无法看到实际问题):

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

我怀疑您未安装与 Visual Studio 相关的内容。如果您使用的是python 2.7,则需要安装VS 2008,然后重新运行setup.py。在python 3.x上,您需要更新的版本(但我不确定最新的是2010年还是2012年)。

另一个更简单的解决方案是安装 mingw,然后执行::

python setup.py build_ext -c mingw32

一个更简单的解决方案是检查您需要的功能是否不在 scipy.cluster 中,它有一个适用于 Windows 的二进制安装程序。 Damian Eads(hcluster 的作者)为该模块做出了相当多的贡献,并且存在显着的重叠。

关于python - 如何构建和安装hcluster?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14412518/

相关文章:

python - 如何制作对数最佳拟合线?

python - 我需要帮助在 discord py 中制作一个 discord py temp mute 命令

python - 假设如果 end_time 低于 start_time,则 pandas 会得到 2 倍的差异,则为第二天

python - 扩展 twins.web 的 static.File 类时出现问题

python - 打印传递给函数的变量名称

python hcluster,距离矩阵和压缩距离矩阵

python - Python中的层次聚类问题