推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shyrock
V2EX  ›  Python

一个 import error 请教

  •  
  •   shyrock · Jul 9, 2014 · 4567 views
    This topic created in 4352 days ago, the information mentioned may be changed or developed.
    运行推荐引擎crab时,报错:
    C:\Python27\lib\site-packages\scipy\spatial\__init__.py in <module>()
    89 from .kdtree import *
    90 from .ckdtree import *
    ---> 91 from .qhull import *
    92 from ._plotutils import *
    93

    ImportError: DLL load failed: 找不到指定的模块。

    新人看不懂from .xxx import这个.是什么意思?
    另外这个错误应该怎么查呢?
    看了原始代码:
    87 from __future__ import division, print_function, absolute_import
    88
    89 from .kdtree import *
    90 from .ckdtree import *
    91 from .qhull import *
    92 from ._plotutils import *
    93
    94 __all__ = [s for s in dir() if not s.startswith('_')]
    95 __all__ += ['distance']

    貌似报错在空行?奇怪
    Supplement 1  ·  Jul 9, 2014
    好吧,我明白 import .xxx 啥意思了。。。
    剩下的问题就是Import Error要怎么查,我看了这几个文件,没有提到有dll啊,不知道为啥报错是DLL load failed
    4 replies    2014-07-09 18:12:08 +08:00
    kaneg
        1
    kaneg  
       Jul 9, 2014   ❤️ 1
    应该是某个module中引入了一个native的库,你的环境是windows,所以是dll load failed。
    具体的原因还得看你的代码
    cakegg
        2
    cakegg  
       Jul 9, 2014   ❤️ 1
    暂时想到两个原因:

    1. 检查Package之间的依赖, 比如numpy之类的package可能也要安装
    2. 版本不对, 某些库的某些特性可能只支持Python 3.x
    shyrock
        3
    shyrock  
    OP
       Jul 9, 2014
    @kaneg 感谢回答。从报错看,是不是应该查92行?
    shyrock
        4
    shyrock  
    OP
       Jul 9, 2014
    找到问题了。。。scipy的spatial目录下少了qhull.py,不知道咋装的。。。
    而且因为新用IPython,没看懂报错信息:
    其实
    ---> 91 from .qhull import *
    这个箭头清晰说明了报错的行,我还在92行折腾了半天。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   943 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:43 · PVG 04:43 · LAX 13:43 · JFK 16:43
    ♥ Do have faith in what you're doing.