Search code examples
windowspython-2.7python-cryptography

Couldnt install Cryptography python module in windows with python 2.7.9


When I execute the command "pip install cryptography", it installs some of its dependencies successfully and it fails with below error.

> _openssl.c
C:\Python27\include\openssl/ossl_typ.h(176) : error C2059: syntax error : 'type'
build\temp.win-amd64-2.7\Release\_openssl.c(481) : fatal error C1083: Cannot ope
n include file: 'openssl/cmac.h': No such file or directory

EDIT: 1] I have installed openssl from "http://gnuwin32.sourceforge.net/packages/openssl.htm" and copied the "include" and "lib" folder from "C:\Program Files (x86)\GnuWin32" to "C:\Python27"

2] I have installed "Microsoft Visual C++ Compiler for Python 2.7" from https://www.microsoft.com/en-in/download/details.aspx?id=44266

Can someone say what exactly am I missing here? Thanks a lot


Solution

  • Compiling cryptography on windows requires setting several environment variables during compile. Fortunately you don't need to compile it yourself. Instead just update your pip to the latest version and it will download a precompiled wheel for you.