Help configuring visual studio to compile python extensions

stephen.boulet at gmail.com stephen.boulet at gmail.com
Sat Jan 10 00:16:36 CET 2015


On Friday, January 9, 2015 at 8:58:59 AM UTC-6, stephen... at gmail.com wrote:
> I've installed Microsoft Visual Studio 10.0. Here are the steps I've been taking.
> 
> My python version is Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32.
> 
> (Sorry for the long output.)
> 
> >cd "c:\Program Files (x86)\Microsoft Visual Studio 10.0"\vc
> >vcvarsall.bat
> >
> >SET VS90COMNTOOLS=%VS100COMNTOOLS%
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>pip install scandir
> Collecting scandir
>   Using cached scandir-0.9.tar.gz
> Installing collected packages: scandir
>   Running setup.py install for scandir
>     building '_scandir' extension
>     C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python34\include -Ic:\Python34\include /Tc_scandir.c /Fobuild\temp.win-amd64-3.4\Release
> \_scandir.obj
>     _scandir.c
>     C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\Python34\libs /LIBPATH:c:\Python34\PCbuild\amd64 /EXPORT:PyInit__scandir build\temp.win
> -amd64-3.4\Release\_scandir.obj /OUT:build\lib.win-amd64-3.4\_scandir.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\_scandir.lib /MANIFESTFILE:build\temp.win-amd64-3.4\Release\_scandir.pyd.manifest
>        Creating library build\temp.win-amd64-3.4\Release\_scandir.lib and object build\temp.win-amd64-3.4\Release\_scandir.exp
>     _scandir.obj : error LNK2001: unresolved external symbol _PyObject_SelfIter
>     _scandir.obj : error LNK2001: unresolved external symbol _PyObject_GenericGetAttr
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_WarnEx referenced in function _win32_warn_bytes_api
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_DeprecationWarning referenced in function _win32_warn_bytes_api
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Occurred referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyBytes_FromObject referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Clear referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_ValueError referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_AsUnicodeAndSize referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_FromObject referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Format referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_TypeError referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp___Py_NoneStruct referenced in function _path_converter
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromUnsignedLong referenced in function _find_data_to_statresult
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyFloat_FromDouble referenced in function _find_data_to_statresult
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromUnsignedLongLong referenced in function _find_data_to_statresult
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromLong referenced in function _find_data_to_statresult
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyStructSequence_New referenced in function _find_data_to_statresult
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyEval_RestoreThread referenced in function __fi_close
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyEval_SaveThread referenced in function __fi_close
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue referenced in function __fi_next
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetFromWindowsErr referenced in function __fi_next
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_NoMemory referenced in function __fi_next
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetNone referenced in function __fi_next
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_StopIteration referenced in function __fi_next
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyObject_Free referenced in function _fi_dealloc
>     _scandir.obj : error LNK2019: unresolved external symbol __imp___PyObject_New referenced in function __iterfile
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTupleAndKeywords referenced in function _scandir_helper
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyStructSequence_InitType referenced in function _PyInit__scandir
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyType_Ready referenced in function _PyInit__scandir
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyModule_Create2 referenced in function _PyInit__scandir
>     build\lib.win-amd64-3.4\_scandir.pyd : fatal error LNK1120: 31 unresolved externals
>     error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\link.exe' failed with exit status 1120
>     Complete output from command c:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\SBO010\\AppData\\Local\\Temp\\pip-build-gd_12t27\\scandir\\setup.py';exec(compile(getattr(t
> okenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\SBO010\AppData\Local\Temp\pip-tzadruqn-record\install-record.txt --single-version-externall
> y-managed --compile:
>     running install
> 
>     running build
> 
>     running build_py
> 
>     creating build
> 
>     creating build\lib.win-amd64-3.4
> 
>     copying scandir.py -> build\lib.win-amd64-3.4
> 
>     running build_ext
> 
>     building '_scandir' extension
> 
>     creating build\temp.win-amd64-3.4
> 
>     creating build\temp.win-amd64-3.4\Release
> 
>     C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python34\include -Ic:\Python34\include /Tc_scandir.c /Fobuild\temp.win-amd64-3.4\Release
> \_scandir.obj
> 
>     _scandir.c
> 
>     C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\Python34\libs /LIBPATH:c:\Python34\PCbuild\amd64 /EXPORT:PyInit__scandir build\temp.win
> -amd64-3.4\Release\_scandir.obj /OUT:build\lib.win-amd64-3.4\_scandir.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\_scandir.lib /MANIFESTFILE:build\temp.win-amd64-3.4\Release\_scandir.pyd.manifest
> 
>        Creating library build\temp.win-amd64-3.4\Release\_scandir.lib and object build\temp.win-amd64-3.4\Release\_scandir.exp
> 
>     _scandir.obj : error LNK2001: unresolved external symbol _PyObject_SelfIter
> 
>     _scandir.obj : error LNK2001: unresolved external symbol _PyObject_GenericGetAttr
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_WarnEx referenced in function _win32_warn_bytes_api
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_DeprecationWarning referenced in function _win32_warn_bytes_api
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Occurred referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyBytes_FromObject referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Clear referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_ValueError referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_AsUnicodeAndSize referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_FromObject referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Format referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_TypeError referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp___Py_NoneStruct referenced in function _path_converter
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromUnsignedLong referenced in function _find_data_to_statresult
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyFloat_FromDouble referenced in function _find_data_to_statresult
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromUnsignedLongLong referenced in function _find_data_to_statresult
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyLong_FromLong referenced in function _find_data_to_statresult
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyStructSequence_New referenced in function _find_data_to_statresult
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyEval_RestoreThread referenced in function __fi_close
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyEval_SaveThread referenced in function __fi_close
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue referenced in function __fi_next
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetFromWindowsErr referenced in function __fi_next
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_NoMemory referenced in function __fi_next
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetNone referenced in function __fi_next
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_StopIteration referenced in function __fi_next
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyObject_Free referenced in function _fi_dealloc
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp___PyObject_New referenced in function __iterfile
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTupleAndKeywords referenced in function _scandir_helper
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyStructSequence_InitType referenced in function _PyInit__scandir
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyType_Ready referenced in function _PyInit__scandir
> 
>     _scandir.obj : error LNK2019: unresolved external symbol __imp__PyModule_Create2 referenced in function _PyInit__scandir
> 
>     build\lib.win-amd64-3.4\_scandir.pyd : fatal error LNK1120: 31 unresolved externals
> 
>     error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\link.exe' failed with exit status 1120
> 
>     ----------------------------------------
>     Command "c:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\SBO010\\AppData\\Local\\Temp\\pip-build-gd_12t27\\scandir\\setup.py';exec(compile(getattr(tokenize, 'open', ope
> n)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\SBO010\AppData\Local\Temp\pip-tzadruqn-record\install-record.txt --single-version-externally-managed --compile"
>  failed with error code 1 in C:\Users\SBO010\AppData\Local\Temp\pip-build-gd_12t27\scandir
> 
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

This page helped me sort everything out: http://www.falatic.com/index.php/120/a-guide-to-building-python-2-x-and-3-x-extensions-for-windows. 



More information about the Python-list mailing list