Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The following one is a way to achieve your goal. There are other, probably better ways (e.g. based on Visual Studio), but this one has worked for me. Additionally, it does not use <code>pip</code>.</p> <p>All operations are carried out on a command prompt.</p> <ol> <li>Install <a href="http://www.mingw.org/" rel="noreferrer">Mingw</a>, including MSYS and the Development Toolkit. This will give you a fairly complete Unix-like development environment.</li> <li>Ensure that Mingw binaries are in PATH environment variable. You need <code>MinGW\bin</code> and <code>MingGW\msys\1.0\bin</code>. </li> <li>Download <a href="http://www.mpir.org/" rel="noreferrer">MPIR</a> sources in a temporary directory. It is important you do <strong>not</strong> use 2.5.1 because of a bug that will break the build. 2.5.0 is fine.</li> <li>Build the MPIR library. This is fairly straightforward: execute <code>bash configure</code> followed by <code>make</code>.</li> <li><strong>HACK #1</strong> Copy <code>libmpir.a</code> from <code>mpir-2.5.0\.libs</code> into <code>C:\Python2.7.1\libs</code>. This is necessary because <code>distutils</code> is broken and I could not find a way to direct it to the correct library location.</li> <li><strong>HACK #2</strong> Edit <code>C:\Python2.7.1\Lib\distutils\cygwincompiler.py</code> and remove any occurrance of the string <code>-mno-cygwin</code>. The reason is explained <a href="http://www.secker.nl/2012/03/08/setup-python-2-7-2-and-mingw-on-windows-xp/" rel="noreferrer">here</a>.</li> <li>Download <a href="https://www.dlitz.net/software/pycrypto/" rel="noreferrer">PyCrypto</a> sources and unpack them in another temporary directory.</li> <li>Set <code>CPPFLAGS</code> environment variable to the MPIR directory, which contains <code>mpir.h</code>.</li> <li><p><strong>HACK 3</strong> Edit <code>setup.py</code> and add the following line in <code>build_extension</code> method: </p> <blockquote> <p>self.__add_compiler_option(os.environ['CPPFLAGS'])</p> </blockquote></li> <li><p>Run <code>bash configure</code>. You should see two lines saying:</p> <blockquote> <p>checking for __gmpz_init in -lgmp... no<br> checking for __gmpz_init in -lmpir... yes</p> </blockquote></li> <li>Execute <code>python setup.py build -c mingw32</code>. You should see no errors.</li> <li>Execute <code>python setup.py test</code> to verify that everything is fine.</li> <li>Execute <code>python setup.py install</code> to copy the files into your local Python repository.</li> <li>Alternatively, run <code>python setup.py bdist_wininst</code> to create an installer.</li> </ol> <p>I really hate all the various hacks, and I'd love to hear if they can be avoided.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload