【问题标题】:Pip install cryptography in windowsPip 在 Windows 中安装密码学
【发布时间】:2017-12-18 18:40:13
【问题描述】:

运行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

我正在使用 python 2.7 运行 Windows 10、64 位。我正在尝试安装密码学 1.9。

【问题讨论】:

标签: python windows pip


【解决方案1】:

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

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

【讨论】:

  • 在 windows 10 x64 上运行良好,但是当我在虚拟环境中尝试相同的时候 - 出现了同样的错误
  • 我也一样@Omkommersind 你找到解决方案了吗?
  • @JohnAndrews 我决定将所有内容都移到 ubuntu 以避免此类问题
  • 在 Windows 10 64bit 上使用 git bash (MINGW64),我设法让它在我的 virtualenv 中工作:1. export LIB="C:\OpenSSL-win64\lib", 2. export INCLUDE="C:\OpenSSL-win64\include" 然后安装使用的库cryptographypip install ... (是的,我实际上需要 64 位版本的 OpenSSL,因为 32 位版本在我的情况下不起作用)。使用python 3.8.3
  • 我不明白为什么我必须安装 lib 才能在 mu venv 中安装密码学包。我确实使用相同的python版本和pip在系统范围内(venv之外)安装了它,并且它工作正常。我不需要安装 OpenSSL。我不想安装不必要的东西。此外,这并不理想,因为生成的 requirements.txt 很可能无法在其他机器上运行,因为它还需要 OpenSSL 的“侧面安装”。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-03
  • 2014-11-12
  • 1970-01-01
  • 1970-01-01
  • 2023-03-16
相关资源
最近更新 更多