2012-03-30 74 views
0

我在Windows 7(64位)上設置VS 2008 SP1並嘗試構建psutil,出現以下錯誤。 VS 2008已正確安裝並且SP1成功進行了修補。Python模塊「psutil」無法在Windows 7 + VS2008SP1環境中構建

我根據包中的INSTALL文件運行「python setup.py build」命令。

 
c:\src\psutil>python setup.py build --verbose 
running build 
running build_py 
running build_ext 
building '_psutil_mswindows' extension 
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo 
/INCREMENTAL:NO /LIBPATH:C:\python_26_amd64\files\libs /LIBPATH:C:\python_26_amd 
64\files\PCbuild\amd64 psapi.lib kernel32.lib advapi32.lib shell32.lib netapi32. 
lib iphlpapi.lib /EXPORT:init_psutil_mswindows build\temp.win-amd64-2.6\Release\ 
psutil/_psutil_mswindows.obj build\temp.win-amd64-2.6\Release\psutil/_psutil_com 
mon.obj build\temp.win-amd64-2.6\Release\psutil/arch/mswindows/process_info.obj 
build\temp.win-amd64-2.6\Release\psutil/arch/mswindows/process_handles.obj build 
\temp.win-amd64-2.6\Release\psutil/arch/mswindows/security.obj /OUT:build\lib.wi 
n-amd64-2.6\_psutil_mswindows.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\psuti 
l\_psutil_mswindows.lib /MANIFESTFILE:build\temp.win-amd64-2.6\Release\psutil\_p 
sutil_mswindows.pyd.manifest 
    Creating library build\temp.win-amd64-2.6\Release\psutil\_psutil_mswindows.lib and object build\temp.win-amd64-2.6\Release\psutil\_psutil_mswindows.exp_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue referenced in function _get_system_uptime 
process_info.obj : error LNK2001: unresolved external symbol __imp__Py_BuildValue 
process_handles.obj : error LNK2001: unresolved external symbol __imp__Py_BuildValue 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyBool_FromLong referenced in function _pid_exists 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTuple referenced in function _pid_exists 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyList_Append referenced in function _get_pid_list 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyList_Append 
process_handles.obj : error LNK2001: unresolved external symbol __imp__PyList_Append 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyList_New referenced in function _get_pid_list_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp___Py_NoneStruct referenced in function _kill_process 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetFromWindowsErr referenced in function _kill_process 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyErr_SetFromWindowsErr 
security.obj : error LNK2001: unresolved external symbol __imp__PyErr_SetFromWindowsErr 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyInt_FromLong referenced in function _process_wait 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyEval_RestoreThread referenced in function _process_wait 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyEval_SaveThread referenced in function _process_wait 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyErr_Clear referenced in function _get_process_cmdline 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyUnicodeUCS2_AsUTF8String referenced in function _get_process_cwd 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyUnicodeUCS2_AsUTF8String 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyUnicodeUCS2_FromWideChar referenced in function _get_process_cwd 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyUnicodeUCS 
2_FromWideChar 
process_handles.obj : error LNK2001: unresolved external symbol __imp__PyUnicodeUCS2_FromWideChar 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyExc_TypeError referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetString referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyExc_NotImplementedError referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyTuple_New referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PySequence_Contains referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PySequence_Check referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromLong referenced in function _get_process_connections 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp___Py_ZeroStruct referenced in function _is_process_suspended 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp___Py_TrueStruct referenced in function _is_process_suspended 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyDict_SetItem referenced in function _get_network_io_counters 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyUnicodeUCS2_FromObject referenced in function _get_network_io_counters 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyUnicodeUCS2_FromObject 
process_handles.obj : error LNK2001: unresolved external symbol __imp__PyUnicodeUCS2_FromObject 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyExc_RuntimeError referenced in function _get_network_io_counters 
process_info.obj : error LNK2001: unresolved external symbol __imp__PyExc_RuntimeError 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyDict_New referenced in function _get_network_io_counters 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyDict_SetItemString referenced in function _get_disk_io_counters 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyModule_AddIntConstant referenced in function _init_psutil_mswindows 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__PyErr_NewException referenced in function _init_psutil_mswindows 
_psutil_mswindows.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4 referenced in function _init_psutil_mswindows 
_psutil_common.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetObject referenced in function _NoSuchProcess 
_psutil_common.obj : error LNK2019: unresolved external symbol __imp__PyObject_CallFunction referenced in function _NoSuchProcess 
_psutil_common.obj : error LNK2019: unresolved external symbol __imp__PyExc_OSError referenced in function _NoSuchProcess 
process_info.obj : error LNK2019: unresolved external symbol __imp__PyErr_Format referenced in function _get_process_info 
build\lib.win-amd64-2.6\_psutil_mswindows.pyd : fatal error LNK1120: 34 unresolved externals 
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120 

任何想法哪些庫缺省默認的distutils配置?我如何在我的環境中成功構建psutil?

回答

5

爲了解決相同問題的其他人的利益:確保使用Visual Studio x64命令提示符啓動安裝腳本。

+0

如果您設置了Visual Studio x64 [(instructions)](http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and- 64-using-msvc-2008-express /)應該可以正常工作。 – Oleksiy 2013-02-06 08:07:11

相關問題