I'm having trouble compiling Cython generated C code to an EXE on Windows.
Windows 10
Python 3.5, 32bit, Anaconda
Visual Studio 14.0
Using this stackoverflow thread, I was able to convert test.py to test.c using the command line:
Python C:\Anaconda3\Scripts\cython-script.py test.py --embed
I tried compiling test.c to test.exe again using the command line:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat x86
# (not shown) cd to test.c directory
cl.exe /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Anaconda3\include -Ic:\Anaconda3\PC /Tctest.c /link /OUT:"test.exe" /SUBSYSTEM:CONSOLE /MACHINE:X86 /LIBPATH:c:\Anaconda3\Lib\site-packages\Cython\Includes\libc /LIBPATH:c:\Anaconda3\Lib\site-packages\Cython\Includes\PCbuild
But the result is an error message:
LINK : fatal error LNK1104: cannot open file 'python35.lib'
I'm not sure what's causing this error, and I'm also not confident that I am pointing to the correct LIBPATH.
I haven't found a thread that solved the issue of Windows + Cython + Anaconda + Python 3.5 + C Compilation. Thanks for any help.
EDIT:
cjrh's answer below solved the initial error and the test.c successfully compiled to test.exe.
however, running test.exe produced the following error:
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
The fix: create a new system variable called PYTHONPATH. In Windows, this is can be done by:
My Computer > Properties > Advanced > Environment Variables.
Making PYTHONPATH include the below fixed the error:
C:\Anaconda3;C:\Anaconda3\DLLs;C:Anaconda3\Lib;C:Anaconda3\Scripts