0

我试图安装一个名为 debacl 的模块,该模块可以在 Windows 64上的https://github.com/CoAxLab/DeBaCl上找到。

我正在使用 install 命令安装模块:

In [18]: run -i setup.py install
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
running install_egg_info
Removing C:\Users\vjons\AppData\Local\Enthought\Canopy\User\Lib\site-packages\debacl-0.2.0-py2.7.egg-info
Writing C:\Users\vjons\AppData\Local\Enthought\Canopy\User\Lib\site-packages\debacl-0.2.0-py2.7.egg-info

然后文件夹 debacl 会在 Canopy\User\Lib\site-packages 文件夹中弹出。但是当我尝试导入新安装的模块时,我收到以下错误消息:

In [3]: import debacl
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-5ef0bbe97964> in <module>()
----> 1 import debacl

C:\Users\vjons\AppData\Local\Enthought\Canopy\User\lib\site-packages\debacl\__init__.py in <module>()
      1 # main debacl __init__.py
      2
----> 3 import geom_tree
      4 import cd_tree
      5 import utils

C:\Users\vjons\AppData\Local\Enthought\Canopy\User\lib\site-packages\debacl\geom_tree.py in <module>()
     24         import utils as utl
     25 except:
---> 26         raise ImportError("Critical packages are not installed.")
     27
     28 try:

ImportError: Critical packages are not installed.

Okaj,我想这意味着必须安装 utils 包才能使用 debacl。但是 utils 包含在 debacl/-文件夹中:

In [4]: ls C:\Users\vjons\AppData\Local\Enthought\Canopy\User\Lib\site-packages\debacl
 Volume in drive C has no label.
 Volume Serial Number is 423B-C99D

 Directory of C:\Users\vjons\AppData\Local\Enthought\Canopy\User\Lib\site-packages\debacl

2014-05-26  16:04                72 __init__.py
2014-05-26  16:05               255 __init__.pyc
2014-05-26  16:04            25 521 cd_tree.py
2014-05-26  16:14            23 466 cd_tree.pyc
2014-05-26  16:04            50 373 geom_tree.py
2014-05-26  16:14            47 087 geom_tree.pyc
2014-05-26  16:05    <DIR>          test
2014-05-26  16:04            21 488 utils.py
2014-05-26  16:14            22 480 utils.pyc

我错过了什么吗?

4

1 回答 1

2

问题实际上不在于绝对导入,而在于您缺少包 python-igraph。两个根本原因:

1)debacl中的setup.py文件导入setuptools失败(应该是第一行)。但这很容易解决(只需单独安装python-igraph),除了......

2) 如果您的系统上没有安装 Microsoft Visual C++ 2008,您将无法根据需要构建 python-igraph。

最简单的解决方案(我刚刚成功测试过)是:

1) 确保 Canopy User Python 是您系统上的默认 Python,使用 Canopy 首选项菜单(您可能需要设置此项,退出 Canopy,然后重新启动 Canopy 以检查是否已设置)。

2)python‑igraph‑0.7.0.win‑amd64‑py2.7.exehttp://www.lfd.uci.edu/~gohlke/pythonlibs/#python-igraph下载

3) 运行上述安装程序。这将安装 python-igraph

然后您应该能够成功导入 debacl。

于 2014-05-27T12:05:38.563 回答