【问题标题】:activestate pythonwin missing import modules?activestate pythonwin 缺少导入模块?
【发布时间】:2009-10-18 03:46:13
【问题描述】:

我正在通过 DiveIntoPython.com 工作,但在导入工作时遇到了麻烦。我在 windows xp prof 环境中安装了 ActiveState 的 Pythonwin。

网站上有一个练习,涉及到'import odbchelper'和odbchelper。name

http://www.diveintopython.org/getting_to_know_python/testing_modules.html

当我以交互方式运行它时,我得到:

>>> import odbchelper
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named odbchelper
>>> odbchelper.__name__
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
NameError: name 'odbchelper' is not defined

我猜要么我没有正确设置路径,要么当我运行“sys.path”时,其中一个文件夹中引用的模块不存在。有什么想法吗?

提前致谢

【问题讨论】:

    标签: python import


    【解决方案1】:

    这个模块肯定不会与 Python2.6 一起打包(只是在我的机器上尝试过)。你试过用谷歌搜索这个模块的位置吗?

    考虑一下post

    【讨论】:

    • 是的,我发现了类似的东西……你打败了我。
    【解决方案2】:

    想通了..

    找到这个:

    http://www.faqs.org/docs/diveintopython/odbchelper_divein.html
    

    下载文件,然后将其放入文件夹中。 c:\temp\python\ 在我的情况下使用命令:

    >> import sys 
    >> sys.path.append('c:\\temp\\python\\')
    

    【讨论】:

    • 我以为它是内置的,但你说得对,它自带 Dive into Python 本身
    猜你喜欢
    • 2018-06-22
    • 1970-01-01
    • 2020-11-03
    • 2019-02-13
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 2017-06-24
    • 2016-12-25
    相关资源
    最近更新 更多