EVOLUTION-MANAGER
Edit File: installation.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Installation and Status — CFFI 1.6.0 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '1.6.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="CFFI 1.6.0 documentation" href="index.html" /> <link rel="next" title="Overview" href="overview.html" /> <link rel="prev" title="What’s New" href="whatsnew.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="overview.html" title="Overview" accesskey="N">next</a> |</li> <li class="right" > <a href="whatsnew.html" title="What’s New" accesskey="P">previous</a> |</li> <li><a href="index.html">CFFI 1.6.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="installation-and-status"> <h1>Installation and Status<a class="headerlink" href="#installation-and-status" title="Permalink to this headline">¶</a></h1> <p>Quick installation for CPython (cffi is distributed with PyPy):</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">cffi</span></tt></li> <li>or get the source code via the <a class="reference external" href="http://pypi.python.org/pypi/cffi">Python Package Index</a>.</li> </ul> <p>In more details:</p> <p>This code has been developed on Linux, but should work on any POSIX platform as well as on Windows 32 and 64. (It relies occasionally on libffi, so it depends on libffi being bug-free; this may not be fully the case on some of the more exotic platforms.)</p> <p>CFFI supports CPython 2.6, 2.7, 3.x (tested with 3.2 to 3.4); and is distributed with PyPy (CFFI 1.0 is distributed with and requires PyPy 2.6).</p> <p>The core speed of CFFI is better than ctypes, with import times being either lower if you use the post-1.0 features, or much higher if you don’t. The wrapper Python code you typically need to write around the raw CFFI interface slows things down on CPython, but not unreasonably so. On PyPy, this wrapper code has a minimal impact thanks to the JIT compiler. This makes CFFI the recommended way to interface with C libraries on PyPy.</p> <p>Requirements:</p> <ul class="simple"> <li>CPython 2.6 or 2.7 or 3.x, or PyPy (PyPy 2.0 for the earliest versions of CFFI; or PyPy 2.6 for CFFI 1.0).</li> <li>in some cases you need to be able to compile C extension modules; refer to the appropriate docs for your OS. This includes installing CFFI from sources; or developing code based on <tt class="docutils literal"><span class="pre">ffi.set_source()</span></tt> or <tt class="docutils literal"><span class="pre">ffi.verify()</span></tt>; or installing such 3rd-party modules from sources.</li> <li>on CPython, on non-Windows platforms, you also need to install <tt class="docutils literal"><span class="pre">libffi-dev</span></tt> in order to compile CFFI itself.</li> <li>pycparser >= 2.06: <a class="reference external" href="https://github.com/eliben/pycparser">https://github.com/eliben/pycparser</a> (automatically tracked by <tt class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">cffi</span></tt>).</li> <li><a class="reference external" href="http://pypi.python.org/pypi/pytest">py.test</a> is needed to run the tests of CFFI itself.</li> </ul> <p>Download and Installation:</p> <ul> <li><p class="first"><a class="reference external" href="http://pypi.python.org/packages/source/c/cffi/cffi-1.6.0.tar.gz">http://pypi.python.org/packages/source/c/cffi/cffi-1.6.0.tar.gz</a></p> <blockquote> <div><ul class="simple"> <li>MD5: ...</li> <li>SHA: ...</li> </ul> </div></blockquote> </li> <li><p class="first">Or grab the most current version from the <a class="reference external" href="https://bitbucket.org/cffi/cffi">Bitbucket page</a>: <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">clone</span> <span class="pre">https://bitbucket.org/cffi/cffi</span></tt></p> </li> <li><p class="first"><tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></tt> or <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup_base.py</span> <span class="pre">install</span></tt> (should work out of the box on Linux or Windows; see below for <a class="reference internal" href="#macos-x">MacOS X</a> or <a class="reference internal" href="#windows-64">Windows 64</a>.)</p> </li> <li><p class="first">running the tests: <tt class="docutils literal"><span class="pre">py.test</span> <span class="pre">c/</span> <span class="pre">testing/</span></tt> (if you didn’t install cffi yet, you need first <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup_base.py</span> <span class="pre">build_ext</span> <span class="pre">-f</span> <span class="pre">-i</span></tt>)</p> </li> </ul> <p>Demos:</p> <ul class="simple"> <li>The <a class="reference external" href="https://bitbucket.org/cffi/cffi/src/default/demo">demo</a> directory contains a number of small and large demos of using <tt class="docutils literal"><span class="pre">cffi</span></tt>.</li> <li>The documentation below might be sketchy on details; for now the ultimate reference is given by the tests, notably <a class="reference external" href="https://bitbucket.org/cffi/cffi/src/default/testing/cffi1/test_verify1.py">testing/cffi1/test_verify1.py</a> and <a class="reference external" href="https://bitbucket.org/cffi/cffi/src/default/testing/cffi0/backend_tests.py">testing/cffi0/backend_tests.py</a>.</li> </ul> <div class="section" id="platform-specific-instructions"> <h2>Platform-specific instructions<a class="headerlink" href="#platform-specific-instructions" title="Permalink to this headline">¶</a></h2> <p><tt class="docutils literal"><span class="pre">libffi</span></tt> is notoriously messy to install and use — to the point that CPython includes its own copy to avoid relying on external packages. CFFI does the same for Windows, but not for other platforms (which should have their own working libffi’s). Modern Linuxes work out of the box thanks to <tt class="docutils literal"><span class="pre">pkg-config</span></tt>. Here are some (user-supplied) instructions for other platforms.</p> <div class="section" id="macos-x"> <h3>MacOS X<a class="headerlink" href="#macos-x" title="Permalink to this headline">¶</a></h3> <p><strong>Homebrew</strong> (Thanks David Griffin for this)</p> <ol class="arabic simple"> <li>Install homebrew: <a class="reference external" href="http://brew.sh">http://brew.sh</a></li> <li>Run the following commands in a terminal</li> </ol> <div class="highlight-python"><pre>brew install pkg-config libffi PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig pip install cffi</pre> </div> <p>Aternatively, <strong>on OS/X 10.6</strong> (Thanks Juraj Sukop for this)</p> <p>For building libffi you can use the default install path, but then, in <tt class="docutils literal"><span class="pre">setup.py</span></tt> you need to change:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">include_dirs</span> <span class="o">=</span> <span class="p">[]</span> </pre></div> </div> <p>to:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">include_dirs</span> <span class="o">=</span> <span class="p">[</span><span class="s">'/usr/local/lib/libffi-3.0.11/include'</span><span class="p">]</span> </pre></div> </div> <p>Then running <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">build</span></tt> complains about “fatal error: error writing to -: Broken pipe”, which can be fixed by running:</p> <div class="highlight-python"><pre>ARCHFLAGS="-arch i386 -arch x86_64" python setup.py build</pre> </div> <p>as described <a class="reference external" href="http://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build">here</a>.</p> </div> <div class="section" id="windows-regular-32-bit"> <h3>Windows (regular 32-bit)<a class="headerlink" href="#windows-regular-32-bit" title="Permalink to this headline">¶</a></h3> <p>Win32 works and is tested at least each official release.</p> <p>The recommended C compiler compatible with Python 2.7 is this one: <a class="reference external" href="http://www.microsoft.com/en-us/download/details.aspx?id=44266">http://www.microsoft.com/en-us/download/details.aspx?id=44266</a> There is a known problem with distutils on Python 2.7, as explained in <a class="reference external" href="https://bugs.python.org/issue23246">https://bugs.python.org/issue23246</a>, and the same problem applies whenever you want to run compile() to build a dll with this specific compiler suite download. <tt class="docutils literal"><span class="pre">import</span> <span class="pre">setuptools</span></tt> might help, but YMMV</p> <p>For Python 3.4 and beyond: <a class="reference external" href="https://www.visualstudio.com/en-us/downloads/visual-studio-2015-ctp-vs">https://www.visualstudio.com/en-us/downloads/visual-studio-2015-ctp-vs</a></p> </div> <div class="section" id="windows-64"> <h3>Windows 64<a class="headerlink" href="#windows-64" title="Permalink to this headline">¶</a></h3> <p>Win64 received very basic testing and we applied a few essential fixes in cffi 0.7. The comment above applies for Python 2.7 on Windows 64 as well. Please report any other issue.</p> <p>Note as usual that this is only about running the 64-bit version of Python on the 64-bit OS. If you’re running the 32-bit version (the common case apparently), then you’re running Win32 as far as we’re concerned.</p> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Installation and Status</a><ul> <li><a class="reference internal" href="#platform-specific-instructions">Platform-specific instructions</a><ul> <li><a class="reference internal" href="#macos-x">MacOS X</a></li> <li><a class="reference internal" href="#windows-regular-32-bit">Windows (regular 32-bit)</a></li> <li><a class="reference internal" href="#windows-64">Windows 64</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="whatsnew.html" title="previous chapter">What’s New</a></p> <h4>Next topic</h4> <p class="topless"><a href="overview.html" title="next chapter">Overview</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/installation.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="overview.html" title="Overview" >next</a> |</li> <li class="right" > <a href="whatsnew.html" title="What’s New" >previous</a> |</li> <li><a href="index.html">CFFI 1.6.0 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2012-2015, Armin Rigo, Maciej Fijalkowski. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>