我正在通过DiveIntoPython.com工作,我无法让导入工作。我在windows xp prof环境中安装了ActiveState的Pythonwin。
在网站上,有一项涉及'import odbchelper'和odbchelper的练习。名称
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'时,其中一个文件夹中引用的模块不存在。有任何想法吗?
提前致谢
答案 0 :(得分:1)
这个模块没有与Python2.6一起打包(只是在我的机器上试过)。你有没有试过谷歌搜索这个模块的位置?
考虑这个post。
答案 1 :(得分:1)
想通了..
发现了这个:
http://www.faqs.org/docs/diveintopython/odbchelper_divein.html
下载该文件,然后将其放入一个文件夹中。 c:\ temp \ python \在我的情况下使用命令:
>> import sys
>> sys.path.append('c:\\temp\\python\\')