title: ImportError: DLL load failed: The operating system cannot run %1
body: <p>I want to build M2Crypto for Windows x64 to be used in python 2.7 in Windows x64.
  I downloaded the library package named: "M2CryptoWin64-master" from: <a href="https://github.com/martinpaljak/M2Crypto" rel="nofollow">https://github.com/martinpaljak/M2Crypto</a></p>
  
  <p>Then, I followed these steps from <a href="https://github.com/dsoprea/M2CryptoWindows" rel="nofollow">enter link description here</a>:</p>
  
  <blockquote>
    <p>In setup.py:</p>
    
    <p>replace self.openssl = 'C:\pkg' by self.openssl =
    'C:\grr-build\openssl' replace name = 'M2Crypto.__m2crypto' , by name
    = '__m2crypto' Build:</p>
    
    <p>set PATH=%PATH%;C:\grr-build\swigwin-2.0.9 C:\Python27\python.exe
    setup.py build C:\Python27\python.exe setup.py install To get M2Crypto
    to work for PyInstaller:</p>
    
    <p>Rename C:\Python27\lib\site-packages\M2Crypto-0.21.1-py2.7-win32.egg
    to C:\Python27\lib\site-packages\M2Crypto-0.21.1-py2.7-win32.egg.zip
    extract M2Crypto-0.21.1-py2.7-win32.egg.zip into
    C:\Python27\lib\site-packages\ without a
    M2Crypto-0.21.1-py2.7-win32.egg sub directory remove
    M2Crypto-0.21.1-py2.7-win32.egg.zip</p>
  </blockquote>
  
  <p>When I test the library by going to Python.exe and type: </p>
  
  <pre><code>&gt;&gt;&gt; import M2Crypto
  </code></pre>
  
  <p>I get this message:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "", line 1, in
       File
    "C:\Python27\lib\site-packages\m2crypto-0.22.3-py2.7-win-amd64.egg\M2Cryp
    to__init__.py", line 22, in 
        import __m2crypto ImportError: DLL load failed: The operating system cannot run %1.</p>
  </blockquote>
  
  <p>Can you please help me figure out how to solve the issue?</p>
  
  <p><strong>EDIT:</strong>
  I also did the following to get M2Crypto to work for PyInstaller:</p>
  
  <blockquote>
    <p>Rename C:\Python27\lib\site-packages\M2Crypto-0.21.1-py2.7-win32.egg to 
    C:\Python27\lib\site-packages\M2Crypto-0.21.1-py2.7-win32.egg.zip
    extract M2Crypto-0.21.1-py2.7-win32.egg.zip into
    C:\Python27\lib\site-packages\ without a
    M2Crypto-0.21.1-py2.7-win32.egg sub directory remove
    M2Crypto-0.21.1-py2.7-win32.egg.zip</p>
  </blockquote>