Python 我的代码在OSX小牛之后失败

Python 我的代码在OSX小牛之后失败,python,Python,我在2.7版上运行的mac pro上编写了一些Python代码,安装Maverick后,我的代码无法在Dimension模块上运行,表示找不到该模块: #!/usr/bin/python from Tkinter import * import tkFont import Dimension class Application(Frame): def __init__(self, master=None): Frame.__init__(self, master)

我在2.7版上运行的mac pro上编写了一些Python代码,安装Maverick后,我的代码无法在Dimension模块上运行,表示找不到该模块:

#!/usr/bin/python
from Tkinter import * 
import tkFont
import Dimension

class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        sz = Dimension(200, 200)
        self.size(sz)
        self.grid()
        self.createWidgets()

    def createWidgets(self):
        ifont = tkFont.Font(family='Courier New', size=14)

        self.quitButton = Button ( self, text='Quit',
                              command=self.quit , font=ifont)
        self.quitButton.grid()
        self.openButton = Button (self, text='Open', command=self.quit)

        self.openButton.grid()

app = Application()
app.master.title("Sample application")
app.mainloop()
错误:

Ganimedes:python denisbopp$ python tutor_01.py
Traceback (most recent call last):
  File "tutor_01.py", line 4, in <module>
    import Dimension
ImportError: No module named Dimension
Ganimedes:python denisbopp$python tutor_01.py
回溯(最近一次呼叫最后一次):
文件“tutor_01.py”,第4行,在
导入维度
ImportError:没有名为Dimension的模块

我认为这是因为升级系统后,您的
PYTHONPATH
发生了更改。你能行

import sys
sys.path
要检查所有包含的路径,请执行以下操作:

sys.path.append('/path /to /the /module')
添加路径


如果模块文件位于
PYTHONPATH
或执行脚本的同一目录中,Python将找到该模块。

并且您100%确定同一目录中有
Dimension.py