Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

python - PIP Cryptography Failing to Install

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 'buildemp.win-amd64-3.8Release\_padding.c' creating buildemp.win-amd64-3.8 creating buildemp.win-amd64-3.8Release
generating cffi module 'buildemp.win-amd64-3.8Release\_constant_time.c' generating cffi module 'buildemp.win-amd64-3.8Release\_openssl.c'
building '_openssl' extension creating buildemp.win-amd64-3.8Releaseuild creating buildemp.win-amd64-3.8Releaseuildemp.win-amd64-3.8 creating buildemp.win-amd64-3.8Releaseuildemp.win-amd64-3.8Release
C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.16.27023inHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Userse004crPycharmProjectsSSLTestvenvinclude -IC: PythonPython38include -IC:PythonPython38include "-IC:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.16.27023ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio 2017ProfessionalVCToolsMSVC14.16.27023include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0ucrt" "-IC:Program Files (x86) Windows Kits10include10.0.17763.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17763.0winrt" "-IC:Program Files (x86)Wind ows Kits10include10.0.17763.0cppwinrt" /Tcbuildemp.win-amd64-3.8Release_openssl.c /Fobuildemp.win-amd64-3.8Releaseuildemp.win-amd64-3.8Release_openssl.obj _openssl.c buildemp.win-amd64-3.8Release_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 Studio2017ProfessionalVCToolsMSVC14.16.27023inHostX86x64cl.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

  1. I am running a virtual environment within PyCharm 2019.2.5 on a Windows 10.
  2. 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)
  3. 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.
  4. 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

enter image description here

3. after clicking add button and search <package name> then install it.

finally, run the program.


Update

Newer versions of Pycharm have a "+" mark (add button) here.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...