【问题标题】:I can see the directory in the python sys.path yet I get an error when I try to import the library?我可以在 python sys.path 中看到目录,但是当我尝试导入库时出现错误?
【发布时间】:2010-12-24 05:00:24
【问题描述】:

我的猜测是我遗漏了一些非常基本和明显的东西,有人可以向我指出。

以下简短命令行会话的屏幕截图显示了以下内容:

我可以看到sys.path 中存在pysal 目录,但是当我尝试import pysal 时出现 ImportError?

【问题讨论】:

  • 那么C:\Users\Max\Documents\Pysal的内容是什么?
  • 一些目录:\core \esda \examples 和一个文件 init.py

标签: python windows import path


【解决方案1】:

Python 导入包和模块sys.path 中的条目,而不是条目本身。这意味着C:\Users\Max\Documents\pysal\pysal.pyC:\Users\Max\Documents\pysal\pysal\__init__.py 必须存在才能被导入。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-03
    • 2017-05-29
    • 1970-01-01
    • 2020-08-17
    • 1970-01-01
    • 2020-07-01
    • 2021-06-02
    相关资源
    最近更新 更多