[Tutor] Can not install pycrypto on Windows 64bit with cygwin(python27)

eryksun eryksun at gmail.com
Sun Sep 23 14:14:20 CEST 2012


On Sun, Sep 23, 2012 at 3:31 AM, Muse Gk <goknmuse at gmail.com> wrote:
>
> C:\Users\gk\Downloads\pycrypto-2.6>python setup.py build --compiler=mingw32 buil
> d_ext -DMS-WIN64

It's "MS_WIN64", with an underscore, not "MS-WIN64" with a hyphen.
This being defined enables another macro that replaces
"Py_InitModule4" in the source with "Py_InitModule4_64". That's
probably why you got the error "undefined reference to
`__imp_Py_InitModule4'".

In case you haven't, you'll also have to manually create
libpython27.a, as I described previously.

Also, so that you don't need to keep typing "build
--compiler=mingw32", you can create
C:\Python27\Lib\distutils\distutils.cfg, containing the following:

    [build]
    compiler = mingw32

Or just use MSVC via the SDK. PyWin32 (a wrapper for the Win32 API and
COM) apparently has to use the MS compiler, which means Windows Python
absolutely has to be built with MSVC. That's the path of least
resistance. With persistent fiddling I'm reasonably certain you can
make MinGW-w64 work with 64-bit Python (at least for plain C
extensions), but even if you solve these immediate problems I can't
say whether or not it will just reveal another error, or how many
errors you'll have to hack around before getting it to work.

I'm off to read http://bugs.python.org/issue3871 to educate myself
about attempts to build Python itself with MinGW.


More information about the Tutor mailing list