每当我运行任何python2程序或打开python解释器时,我都会收到以下错误。
Public Event KeyDown As KeyboardHookCallback
Public Event KeyUp As KeyboardHookCallback
Private Function HookFunc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
If (nCode >= 0) Then
Dim iwParam As Integer = wParam.ToInt32
If ((iwParam = WM_KEYDOWN) _
OrElse (iwParam = WM_SYSKEYDOWN)) Then
If (Not RaiseEvent KeyDown Is Nothing) Then
RaiseEvent KeyDown(CType(Marshal.ReadInt32(lParam), VKeys))
End If
End If
If ((iwParam = WM_KEYUP) _
OrElse (iwParam = WM_SYSKEYUP)) Then
If (Not RaiseEvent KeyUp Is Nothing) Then
RaiseEvent KeyUp(CType(Marshal.ReadInt32(lParam), VKeys))
End If
End If
End If
Return CallNextHookEx(hookID, nCode, wParam, lParam)
End Function
如果我触发以下命令
$~/python> python setup.py
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
我收到以下错误
$ export PYTHONPATH=/usr/local/lib/python2.7
我也尝试使用以下命令重新安装python
ImportError: No module named site
但它有点帮助。
提前致谢。
答案 0 :(得分:-1)
导出PYTHONHOME = / usr / local。 Python应该安装在OS X上的/ usr / local中。