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