skeuomorf | bc26efb | 2014-01-29 08:31:47 +0200 | [diff] [blame^] | 1 | Installing |
| 2 | ========== |
| 3 | |
| 4 | You can install ``cryptography`` with ``pip``: |
| 5 | |
| 6 | .. code-block:: console |
| 7 | |
| 8 | $ pip install cryptography |
| 9 | |
| 10 | Installation Notes |
| 11 | ================== |
| 12 | On Windows |
| 13 | ---------- |
| 14 | .. note:: |
| 15 | |
| 16 | If you're on Windows you'll need to make sure you have OpenSSL installed. |
| 17 | There are `pre-compiled binaries`_ available. If your installation is in |
| 18 | an unusual location set the ``LIB`` and ``INCLUDE`` environment variables |
| 19 | to include the corresponding locations. For example: |
| 20 | |
| 21 | .. code-block:: console |
| 22 | |
| 23 | C:\> \path\to\vcvarsall.bat x86_amd64 |
| 24 | C:\> set LIB=C:\OpenSSL-1.0.1f-64bit\lib;%LIB% |
| 25 | C:\> set INCLUDE=C:\OpenSSL-1.0.1f-64bit\include;%INCLUDE% |
| 26 | C:\> pip install cryptography |
| 27 | |
| 28 | Using your own OpenSSL on Linux |
| 29 | ------------------------------- |
| 30 | |
| 31 | Python links to OpenSSL for its own purposes and this can sometimes cause |
| 32 | problems when you wish to use a different version of OpenSSL with cryptography. |
| 33 | If you want to use cryptography with your own build of OpenSSL you will need to |
| 34 | make sure that the build is configured correctly so that your version of |
| 35 | OpenSSL doesn't conflict with Python's. |
| 36 | |
| 37 | The options you need to add allow the linker to identify every symbol correctly |
| 38 | even when multiple versions of the library are linked into the same program. If |
| 39 | you are using your distribution's source packages these will probably be |
| 40 | patched in for you already, otherwise you'll need to use options something like |
| 41 | this when configuring OpenSSL: |
| 42 | |
| 43 | .. code-block:: console |
| 44 | |
| 45 | $ ./config -Wl,--version-script=openssl.ld -Wl,-Bsymbolic-functions -fPIC shared |
| 46 | |
| 47 | You'll also need to generate your own ``openssl.ld`` file. For example:: |
| 48 | |
| 49 | OPENSSL_1.0.1F_CUSTOM { |
| 50 | global: |
| 51 | *; |
| 52 | }; |
| 53 | |
| 54 | You should replace the version string on the first line as appropriate for your |
| 55 | build. |
| 56 | |
| 57 | Using your own OpenSSL on OS X |
| 58 | ------------------------------ |
| 59 | |
| 60 | To link cryptography against a custom version of OpenSSL you'll need to set |
| 61 | ``ARCHFLAGS``, ``LDFLAGS``, and ``CFLAGS``. OpenSSL can be installed via |
| 62 | `Homebrew`_: |
| 63 | |
| 64 | .. code-block:: console |
| 65 | |
| 66 | $ brew install openssl |
| 67 | |
| 68 | Then install cryptography linking against the brewed version: |
| 69 | |
| 70 | .. code-block:: console |
| 71 | |
| 72 | $ env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography |
| 73 | |
| 74 | |
| 75 | .. _`Homebrew`: http://brew.sh |
| 76 | .. _`pre-compiled binaries`: https://www.openssl.org/related/binaries.html |