我是Python新手,很难用Wing IDE/Python 2.7/Mac OS导入模块
我读过: Import module from other directory in Wing Ide
以及: http://docs.python.org/2/tutorial/modules.html
但我还是不明白。
如果如第二个链接所示,我创建了一个fibo.py脚本并将其保存在Python路径中,那么当我尝试导入它时,会出现以下错误:
import fibo
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
ImportError: No module named fibo
虽然fibo在我输入时可以自动完成
import
我错过了什么? 谢谢你的回答
该错误表示在路径上找不到该模块,因此要么该模块位于错误的位置,要么该路径不是您所认为的路径。您可以查看sys.path(在“import sys”之后)以查看路径。
我不知道为什么永安会在那里提供自动完成服务。一种可能是,您已经在项目属性中修改了Python路径(或者在Wing 101中配置Python对话框),还没有从选项菜单中重新启动Python Shell。
相关问题 更多 >
编程相关推荐