Pip在Windows中安装加密

the*_*ire 3 python windows pip

我在运行时遇到以下错误pip install cryptography:

build\temp.win32-2.7\Release\_openssl.c(434) : fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory

我正在运行Windows 10,64位,使用python 2.7.我正在尝试安装加密1.9.

the*_*ire 11

安装openssl和更改环境变量为我解决了这个问题.

  • 从这里使用安装程序安装OpenSSL:https://slproweb.com/products/Win32OpenSSL.html
  • 使用Win32OpenSSL-1_1_0f,即使你的系统是64位(我尝试安装64位版本的OpenSSL,这没有解决问题)
  • 下面的两个文件夹现在应该存在:C:\OpenSSL-Win32\include,C:\OpenSSL-Win32\lib
  • 打开cmd行终端并运行以下命令:
  • > set INCLUDE=C:\OpenSSL-Win32\include;%INCLUDE%
  • > set LIB=C:\OpenSSL-Win32\lib;%LIB%
  • > pip install cryptography

  • 在 Windows 10 64 位上使用 `git bash` (MINGW64),我设法让它在我的 virtualenv 中工作: 1. `export LIB="C:\OpenSSL-win64\lib"`, 2. `export INCLUDE="C :\OpenSSL-win64\include"` 然后安装使用 `cryptography` 和 `pip install ...` 的库(是的,我实际上需要 64 位版本的 OpenSSL,因为 32 位版本不起作用就我而言)。使用Python 3.8.3 (2认同)
  • 我不明白为什么我必须安装 lib 才能在 mu venv 中安装加密包。我确实使用相同的 python 版本和 pip 在系统范围内(在 venv 之外)安装了它,并且它有效。我不需要安装 OpenSSL。我不想安装不必要的东西。此外,这并不理想,因为生成的 requests.txt 很可能无法在其他计算机上运行,​​因为它还需要 OpenSSL 的“侧面安装”。 (2认同)