问题
There are a quite a few answers to this question covering a ton of different scenarios but I've yet to find a solution to the self-same issue. When I try to install pip install cryptography I get:
generating cffi module 'build\temp.win-amd64-3.8\Release\_padding.c' creating build\temp.win-amd64-3.8 creating build\temp.win-amd64-3.8\Release
generating cffi module 'build\temp.win-amd64-3.8\Release\_constant_time.c' generating cffi module 'build\temp.win-amd64-3.8\Release\_openssl.c'
building '_openssl' extension creating build\temp.win-amd64-3.8\Release\build creating build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8 creating build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\be004cr\PycharmProjects\SSLTest\venv\include -IC:\ Python\Python38\include -IC:\Python\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\ 2017\Professional\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86) \Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Wind ows Kits\10\include\10.0.17763.0\cppwinrt" /Tcbuild\temp.win-amd64-3.8\Release_openssl.c /Fobuild\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8\Release_openssl.obj _openssl.c build\temp.win-amd64-3.8\Release_openssl.c(498): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2---------------------------------------- Failed building wheel for cryptography Running setup.py clean for cryptography Failed to build cryptography Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
- I am running a virtual environment within PyCharm 2019.2.5 on a Windows 10.
- I have installed OpenSSL from https://slproweb.com/products/Win32OpenSSL.html and selected the latest 32bit version (I had the 64bit installed at first attempt but read elsewhere people had trouble with this so swtiched to 32bit)
- I have updated the LIB and INCLUDE locations to the relevant ../openssl/include and ../openssl/lib locations and tried re-running the pip install but I keep gettng the same message. I've done this within the terminal within PyCharm and the standard CMD prompt.
- I'm running PIP version 19.0.3
I'm sure I'm missing something super simple. Just don't know what.
I'm looking to use the cryptography (originally planned to use pyopenssl but have noticed it's been superceded by cryptography) to enable HTTPS for my flask application.
Is there anything I've missed? I feel there is.
Many thanks
回答1:
You can try this
1. Open PyCharm.
2. go to File -> settings -> Project:test(test means your project name) -> select project interpretor -> click add button
3. after clicking add button and search cryptography
then install it.
finally run the program.
来源:https://stackoverflow.com/questions/59143740/pip-cryptography-failing-to-install