HowTo Use Cython on a Windows XP Box?

D

David Lees

August 31, 2007

I just downloaded the current Cython release and have no problem running
the cpython.py translator on the demo code. But when I try compiling, I
get an error complaining that my version of Python (which is the current
2.5.1 downloaded from python.org) was compiled with Visual C++ 2003. I
only have Visual C++ 2005 on my machine and am unable to find a download
of 2003 on the Microsoft site (no big surprise). I have never built
Python from source. Is it necessary or can someone suggest an alternative?

TIA

david lees
 
P

Paul McGuire

August 31, 2007

I just downloaded the current Cython release and have no problem running
the cpython.py translator on the demo code. But when I try compiling, I
get an error complaining that my version of Python (which is the current
2.5.1 downloaded from python.org) was compiled with Visual C++ 2003. I
only have Visual C++ 2005 on my machine and am unable to find a download
of 2003 on the Microsoft site (no big surprise). I have never built
Python from source. Is it necessary or can someone suggest an alternative?

TIA

david lees

Unless you are customizing Python (and you can accomplish a *lot*
without doing so), it is not necessary to build Python from source.
Download one of the pre-built Windows binaries and install it, or get
the Win Python distribution from ActiveState and install that. Then
start writing your own Python demo scripts.

-- Paul
 
J

John Machin

Unless you are customizing Python (and you can accomplish a *lot*
without doing so), it is not necessary to build Python from source.
Download one of the pre-built Windows binaries and install it, or get
the Win Python distribution from ActiveState and install that. Then
start writing your own Python demo scripts.

Paul, AFAICT the OP is referring not to CPython, but to Cython, which
is a Pyrex fork. See http://www.cython.org/

Building CPython from source is likely to be a red herring. The OP's
question appears to be "How do I, on Windows, compile C code generated
by Cython into a pyd that will play happily with the standard-issue
python.exe and python25.dll?", and is probably best directed to one of
the 3 forums mentioned on the above-referenced page.

HTH,
John
 
D

David Lees

John said:
Paul, AFAICT the OP is referring not to CPython, but to Cython, which
is a Pyrex fork. See http://www.cython.org/

Building CPython from source is likely to be a red herring. The OP's
question appears to be "How do I, on Windows, compile C code generated
by Cython into a pyd that will play happily with the standard-issue
python.exe and python25.dll?", and is probably best directed to one of
the 3 forums mentioned on the above-referenced page.

HTH,
John
John,

Yes, you are correct in understanding my question. I thought my post
was clear, but I guess not. I will go try the pyrex list.
 
D

David Bolen

David Lees said:
Yes, you are correct in understanding my question. I thought my post
was clear, but I guess not. I will go try the pyrex list.

You might also try looking for references to distutils support for
non-MS compilers, since Pyrex (and presumably Cython) uses distutils
under the covers to build the final extension. I'm pretty sure there
is support in recent Python releases for using mingw rather than MSVC
for most extensions (there may be problems with using certain Python
APIs that depending on specific C RTL structures like files).

As to using VC, yes, it does have to be VC 7.1, e.g,. Visual Studio
2003. You can't use 2005, as MS didn't maintain runtime
compatibility. I'm sure there are a number of threads about that also
available. If I recall correctly, VC 7.1 began to be used in the 2.4
timeframe - although it was getting discussed back when 2.3 was
getting released, based on an offer Microsoft had made to provide
copies to core developers. The discussions are archived, but VC 6 was
definitely long in the tooth at that point. As the development tools
aren't free, they haven't been upgraded past that point to date. It's
unfortunate that when MS changed the main runtime DLL with VC 7 (for
the first time in a pretty long time), that they then did so
immediately again (and incompatibly) with VC 8.

At the time, there were also efforts with some success to use the free
toolkit MS made available (although I think it was sans optimizer),
but then I think that got pulled and/or it became more difficult to
find/use, but my memory is fuzzy.

You mention having VS 2005 - if so, do you also have an MSDN
subscription? I believe you should still be able to get VS 2003 via
that route if you first started with 2005 and thus never had 2003. If
not, the mingw approach may be your best bet.

-- David
 
P

Paul McGuire

Paul, AFAICT the OP is referring not to CPython, but to Cython, which
is a Pyrex fork. Seehttp://www.cython.org/

Building CPython from source is likely to be a red herring. The OP's
question appears to be "How do I, on Windows, compile C code generated
by Cython into a pyd that will play happily with the standard-issue
python.exe and python25.dll?", and is probably best directed to one of
the 3 forums mentioned on the above-referenced page.

HTH,
John- Hide quoted text -

- Show quoted text -

Thanks, I thought "Cython" was a typo of "CPython".

Glad the OP found a better-informed resource.

-- Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top