- Docs »
- Installation
- Edit on GitHub
The installation procedure depends on the package you want the library to be in.PyCryptodome can be used as:
an almost drop-in replacement for the old PyCrypto library.You install it with:
pip install pycryptodomeIn this case, all modules are installed under the
Crypto
package.You can test everything is right with:python -m Crypto.SelfTestOne must avoid having both PyCrypto and PyCryptodome installedat the same time, as they will interfere with each other.
This option is therefore recommended only when you are sure thatthe whole application is deployed in a
virtualenv
.a library independent of the old PyCrypto.You install it with:
pip install pycryptodomexYou can test everything is right with:
python -m Cryptodome.SelfTestIn this case, all modules are installed under the
Cryptodome
package.PyCrypto and PyCryptodome can coexist.
The procedures below go a bit more in detail, by explaininghow to setup the environment for compiling the C extensionsfor each OS, and how to install the GMP library.
Compiling in Linux Ubuntu¶
Note
If you want to install under the Crypto
package, replacebelow pycryptodomex
with pycryptodome
.
For Python 2.x:
$ sudo apt-get install build-essential libgmp3-dev python-dev$ pip install pycryptodomex$ python -m Cryptodome.SelfTest
For Python 3.x:
$ sudo apt-get install build-essential libgmp3-dev python3-dev$ pip install pycryptodomex$ python3 -m Cryptodome.SelfTest
For PyPy:
$ sudo apt-get install build-essential libgmp3-dev pypy-dev$ pip install pycryptodomex$ pypy -m Cryptodome.SelfTest
Compiling in Linux Fedora¶
Note
If you want to install under the Crypto
package, replacebelow pycryptodomex
with pycryptodome
.
For Python 2.x:
$ sudo yum install gcc gmp python-devel$ pip install pycryptodomex$ python -m Cryptodome.SelfTest
For Python 3.x:
$ sudo yum install gcc gmp python3-devel$ pip install pycryptodomex$ python3 -m Cryptodome.SelfTest
For PyPy:
$ sudo yum install gcc gmp pypy-devel$ pip install pycryptodomex$ pypy -m Cryptodome.SelfTest
Windows (from sources, Python 2.x, Python <=3.2)¶
Note
If you want to install under the Crypto
package, replacebelow pycryptodomex
with pycryptodome
.
Windows does not come with a C compiler like most Unix systems.The simplest way to compile the Pycryptodome extensions fromsource code is to install the minimum set of Visual Studiocomponents freely made available by Microsoft.
Run Python from the command line and note down its versionand whether it is a 32 bit or a 64 bit application.
For instance, if you see:
Python 2.7.2+ ... [MSC v.1500 32 bit (Intel)] on win32
you clearly have Python 2.7 and it is a 32 bit application.
[Only once] Install Virtual Clone Drive.
[Only once] Download the ISO image of theMS SDK for Windows 7 and . NET Framework 3.5 SP1.It contains the Visual C++ 2008 compiler.
There are three ISO images available: you will need
GRMSDK_EN_DVD.iso
if yourWindows OS is 32 bits orGRMSDKX_EN_DVD.iso
if 64 bits.Mount the ISO with Virtual Clone Drive and install the C/C++ compilers and theredistributable only.
If your Python is a 64 bit application, open a command prompt and perform the following steps:
> cd "C:\Program Files\Microsoft SDKs\Windows\v7.0"> cmd /V:ON /K Bin\SetEnv.Cmd /x64 /release> set DISTUTILS_USE_SDK=1
Replace
/x64
with/x86
if your Python is a 32 bit application.Compile and install PyCryptodome:
> pip install pycryptodomex --no-use-wheel
To make sure everything work fine, run the test suite:
> python -m Cryptodome.SelfTest
Windows (from sources, Python 3.3 and 3.4)¶
Note
If you want to install under the Crypto
package, replacebelow pycryptodomex
with pycryptodome
.
Windows does not come with a C compiler like most Unix systems.The simplest way to compile the Pycryptodome extensions fromsource code is to install the minimum set of Visual Studiocomponents freely made available by Microsoft.
Run Python from the command line and note down its versionand whether it is a 32 bit or a 64 bit application.
For instance, if you see:
Python 2.7.2+ ... [MSC v.1500 32 bit (Intel)] on win32
you clearly have Python 2.7 and it is a 32 bit application.
[Only once] Install Virtual Clone Drive.
[Only once] Download the ISO image of theMS SDK for Windows 7 and . NET Framework 4.It contains the Visual C++ 2010 compiler.
There are three ISO images available: you will need
GRMSDK_EN_DVD.iso
if yourWindows OS is 32 bits orGRMSDKX_EN_DVD.iso
if 64 bits.Mount the ISO with Virtual Clone Drive and install the C/C++ compilers and theredistributable only.
If your Python is a 64 bit application, open a command prompt and perform the following steps:
> cd "C:\Program Files\Microsoft SDKs\Windows\v7.1"> cmd /V:ON /K Bin\SetEnv.Cmd /x64 /release> set DISTUTILS_USE_SDK=1
Replace
/x64
with/x86
if your Python is a 32 bit application.Compile and install PyCryptodome:
> pip install pycryptodomex --no-use-wheel
To make sure everything work fine, run the test suite:
> python -m Cryptodome.SelfTest
Windows (from sources, Python 3.5 and newer)¶
Note
If you want to install under the Crypto
package, replacebelow pycryptodomex
with pycryptodome
.
Windows does not come with a C compiler like most Unix systems.The simplest way to compile the PyCryptodome extensions fromsource code is to install the minimum set of Visual Studiocomponents freely made available by Microsoft.
[Once only] Download MS Visual Studio 2015(Community Edition) and install the C/C++ compilers and the redistributable only.
Compile and install PyCryptodome:
> pip install pycryptodomex --no-use-wheel
To make sure everything work fine, run the test suite:
> python -m Cryptodome.SelfTest
Documentation¶
Project documentation is written in reStructuredText and it is stored under Doc/src
.To publish it as HTML files, you need to install sphinx anduse:
> make -C Doc/ html
It will then be available under Doc/_build/html/
.
PGP verification¶
All source packages and wheels on PyPI are cryptographically signed.They can be verified with the following PGP key:
-----BEGIN PGP PUBLIC KEY BLOCK-----mQINBFTXjPgBEADc3j7vnma9MXRshBPPXXenVpthQD6lrF/3XaBT2RptSf/viOD+tz85du5XVp+r0SYYGeMNJCQ9NsztxblN/lnKgkfWRmSrB+V6QGS+e3bR5d9OIxzN7haPxBnyRj//hCT/kKis6fa7N9wtwKBBjbaSX+9vpt7Rrt203sKfcChA4iR3EG89TNQoc/kGGmwk/gyjfU38726v0NOhMKJp2154iQQVZ76hTDk6GkOYHTcPxdkAj4jSDd74M9sOtoOlyDLHOLcWNnlWGgZjtz0z0qSyFXRSuOfggTxrepWQgKWXXzgVB4Jo0bhmXPAV8vkX5BoG6zGkYb47NGGvknax6jCvFYTCp1sOmVtf5UTVKPplFm077tQg0KZNAvEQrdWRIiQ1cCGCoF2Alex3VmVdefHOhNmyY7xAlzpP0c8z1DsgZgMnytNnGPusWeqQVijRxenl+lyhbkb9ZLDq7mOkCRXSze9J2+5aLTJbJu3+Wx6BEyNIHP/fK3E77nXvC0oKaYTbTwEQSBAggAXP+7oQaA0ea2SLO176xJdNfC5lkQEtMMSZI4gNiSqjUxXW2N5qEHHex1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TBdAOTiN3zMbGX0QOO2fOsJ1d980cVjHn5CbAo8C0A/4/R2cXAfpacbvTiNq5BVk9NKa2dNbkmnTStP2qILWmm5ASXlWhOjWNmptvsUcK+8T+uQboLioEv19Ob4j5Irs/OpOuP0Kv4woCi9+03HMS42qGSe/igClFO3+gUMZg9PJnTJhuaTbytXhUBgBRUPsS+lQAQ===DpoI-----END PGP PUBLIC KEY BLOCK-----
Read the Docs v: v3.6.1
- Versions
- latest
- stable
- v3.6.1
- Downloads
- On Read the Docs
- Project Home
- Builds
Free document hosting provided by Read the Docs.