• pip cryptography 遇到的 OpenSSL 问题


    pip install -r requirements.txt 遇到 bug
     

    1. Collecting cryptography==2.7
    2. Downloading cryptography-2.7.tar.gz (495 kB)
    3. ------------------------------------- 495.9/495.9 kB 15.7 MB/s eta 0:00:00
    4. Installing build dependencies: started
    5. Installing build dependencies: finished with status 'done'
    6. Getting requirements to build wheel: started
    7. Getting requirements to build wheel: finished with status 'done'
    8. Preparing metadata (pyproject.toml): started
    9. Preparing metadata (pyproject.toml): finished with status 'done'
    10. Collecting asn1crypto>=0.21.0 (from cryptography==2.7)
    11. Using cached asn1crypto-1.5.1-py2.py3-none-any.whl (105 kB)
    12. Requirement already satisfied: six>=1.4.1 in d:\workproject\2023\7_11\bkom\venv\lib\site-packages (from cryptography==2.7) (1.16.0)
    13. Requirement already satisfied: cffi!=1.11.3,>=1.8 in d:\workproject\2023\7_11\bkom\venv\lib\site-packages (from cryptography==2.7) (1.15.1)
    14. Requirement already satisfied: pycparser in d:\workproject\2023\7_11\bkom\venv\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography==2.7) (2.21)
    15. Building wheels for collected packages: cryptography
    16. Building wheel for cryptography (pyproject.toml): started
    17. Building wheel for cryptography (pyproject.toml): finished with status 'error'
    18. Failed to build cryptography
    19. error: subprocess-exited-with-error
    20. Building wheel for cryptography (pyproject.toml) did not run successfully.
    21. exit code: 1
    22. [144 lines of output]
    23. <string>:14: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    24. running bdist_wheel
    25. running build
    26. running build_py
    27. creating build
    28. creating build\lib.win-amd64-cpython-39
    29. creating build\lib.win-amd64-cpython-39\cryptography
    30. copying src\cryptography\exceptions.py -> build\lib.win-amd64-cpython-39\cryptography
    31. copying src\cryptography\fernet.py -> build\lib.win-amd64-cpython-39\cryptography
    32. copying src\cryptography\utils.py -> build\lib.win-amd64-cpython-39\cryptography
    33. copying src\cryptography\__about__.py -> build\lib.win-amd64-cpython-39\cryptography
    34. copying src\cryptography\__init__.py -> build\lib.win-amd64-cpython-39\cryptography
    35. creating build\lib.win-amd64-cpython-39\cryptography\hazmat
    36. copying src\cryptography\hazmat\_oid.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat
    37. copying src\cryptography\hazmat\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat
    38. creating build\lib.win-amd64-cpython-39\cryptography\x509
    39. copying src\cryptography\x509\base.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    40. copying src\cryptography\x509\certificate_transparency.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    41. copying src\cryptography\x509\extensions.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    42. copying src\cryptography\x509\general_name.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    43. copying src\cryptography\x509\name.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    44. copying src\cryptography\x509\ocsp.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    45. copying src\cryptography\x509\oid.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    46. copying src\cryptography\x509\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\x509
    47. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\backends
    48. copying src\cryptography\hazmat\backends\interfaces.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends
    49. copying src\cryptography\hazmat\backends\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends
    50. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings
    51. copying src\cryptography\hazmat\bindings\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings
    52. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    53. copying src\cryptography\hazmat\primitives\cmac.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    54. copying src\cryptography\hazmat\primitives\constant_time.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    55. copying src\cryptography\hazmat\primitives\hashes.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    56. copying src\cryptography\hazmat\primitives\hmac.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    57. copying src\cryptography\hazmat\primitives\keywrap.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    58. copying src\cryptography\hazmat\primitives\padding.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    59. copying src\cryptography\hazmat\primitives\poly1305.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    60. copying src\cryptography\hazmat\primitives\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives
    61. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    62. copying src\cryptography\hazmat\backends\openssl\aead.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    63. copying src\cryptography\hazmat\backends\openssl\backend.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    64. copying src\cryptography\hazmat\backends\openssl\ciphers.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    65. copying src\cryptography\hazmat\backends\openssl\cmac.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    66. copying src\cryptography\hazmat\backends\openssl\decode_asn1.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    67. copying src\cryptography\hazmat\backends\openssl\dh.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    68. copying src\cryptography\hazmat\backends\openssl\dsa.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    69. copying src\cryptography\hazmat\backends\openssl\ec.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    70. copying src\cryptography\hazmat\backends\openssl\ed25519.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    71. copying src\cryptography\hazmat\backends\openssl\ed448.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    72. copying src\cryptography\hazmat\backends\openssl\encode_asn1.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    73. copying src\cryptography\hazmat\backends\openssl\hashes.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    74. copying src\cryptography\hazmat\backends\openssl\hmac.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    75. copying src\cryptography\hazmat\backends\openssl\ocsp.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    76. copying src\cryptography\hazmat\backends\openssl\poly1305.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    77. copying src\cryptography\hazmat\backends\openssl\rsa.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    78. copying src\cryptography\hazmat\backends\openssl\utils.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    79. copying src\cryptography\hazmat\backends\openssl\x25519.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    80. copying src\cryptography\hazmat\backends\openssl\x448.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    81. copying src\cryptography\hazmat\backends\openssl\x509.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    82. copying src\cryptography\hazmat\backends\openssl\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\backends\openssl
    83. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings\openssl
    84. copying src\cryptography\hazmat\bindings\openssl\binding.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings\openssl
    85. copying src\cryptography\hazmat\bindings\openssl\_conditional.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings\openssl
    86. copying src\cryptography\hazmat\bindings\openssl\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\bindings\openssl
    87. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    88. copying src\cryptography\hazmat\primitives\asymmetric\dh.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    89. copying src\cryptography\hazmat\primitives\asymmetric\dsa.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    90. copying src\cryptography\hazmat\primitives\asymmetric\ec.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    91. copying src\cryptography\hazmat\primitives\asymmetric\ed25519.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    92. copying src\cryptography\hazmat\primitives\asymmetric\ed448.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    93. copying src\cryptography\hazmat\primitives\asymmetric\padding.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    94. copying src\cryptography\hazmat\primitives\asymmetric\rsa.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    95. copying src\cryptography\hazmat\primitives\asymmetric\utils.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    96. copying src\cryptography\hazmat\primitives\asymmetric\x25519.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    97. copying src\cryptography\hazmat\primitives\asymmetric\x448.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    98. copying src\cryptography\hazmat\primitives\asymmetric\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\asymmetric
    99. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    100. copying src\cryptography\hazmat\primitives\ciphers\aead.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    101. copying src\cryptography\hazmat\primitives\ciphers\algorithms.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    102. copying src\cryptography\hazmat\primitives\ciphers\base.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    103. copying src\cryptography\hazmat\primitives\ciphers\modes.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    104. copying src\cryptography\hazmat\primitives\ciphers\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\ciphers
    105. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    106. copying src\cryptography\hazmat\primitives\kdf\concatkdf.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    107. copying src\cryptography\hazmat\primitives\kdf\hkdf.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    108. copying src\cryptography\hazmat\primitives\kdf\kbkdf.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    109. copying src\cryptography\hazmat\primitives\kdf\pbkdf2.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    110. copying src\cryptography\hazmat\primitives\kdf\scrypt.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    111. copying src\cryptography\hazmat\primitives\kdf\x963kdf.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    112. copying src\cryptography\hazmat\primitives\kdf\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\kdf
    113. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\serialization
    114. copying src\cryptography\hazmat\primitives\serialization\base.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\serialization
    115. copying src\cryptography\hazmat\primitives\serialization\pkcs12.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\serialization
    116. copying src\cryptography\hazmat\primitives\serialization\ssh.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\serialization
    117. copying src\cryptography\hazmat\primitives\serialization\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\serialization
    118. creating build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\twofactor
    119. copying src\cryptography\hazmat\primitives\twofactor\hotp.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\twofactor
    120. copying src\cryptography\hazmat\primitives\twofactor\totp.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\twofactor
    121. copying src\cryptography\hazmat\primitives\twofactor\utils.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\twofactor
    122. copying src\cryptography\hazmat\primitives\twofactor\__init__.py -> build\lib.win-amd64-cpython-39\cryptography\hazmat\primitives\twofactor
    123. running egg_info
    124. writing src\cryptography.egg-info\PKG-INFO
    125. writing dependency_links to src\cryptography.egg-info\dependency_links.txt
    126. writing requirements to src\cryptography.egg-info\requires.txt
    127. writing top-level names to src\cryptography.egg-info\top_level.txt
    128. reading manifest file 'src\cryptography.egg-info\SOURCES.txt'
    129. reading manifest template 'MANIFEST.in'
    130. no previously-included directories found matching 'docs\_build'
    131. warning: no previously-included files found matching 'vectors'
    132. warning: no previously-included files matching '*' found under directory 'vectors'
    133. warning: no previously-included files found matching 'azure-pipelines.yml'
    134. warning: no previously-included files found matching '.azure-pipelines'
    135. warning: no previously-included files found matching '.travis.yml'
    136. warning: no previously-included files found matching '.travis'
    137. warning: no previously-included files matching '*' found under directory '.azure-pipelines'
    138. warning: no previously-included files matching '*' found under directory '.travis'
    139. warning: no previously-included files found matching 'release.py'
    140. warning: no previously-included files found matching '.coveragerc'
    141. warning: no previously-included files found matching 'codecov.yml'
    142. warning: no previously-included files found matching 'dev-requirements.txt'
    143. warning: no previously-included files found matching 'rtd-requirements.txt'
    144. warning: no previously-included files found matching 'tox.ini'
    145. adding license file 'LICENSE'
    146. adding license file 'LICENSE.APACHE'
    147. adding license file 'LICENSE.BSD'
    148. adding license file 'LICENSE.PSF'
    149. adding license file 'AUTHORS.rst'
    150. writing manifest file 'src\cryptography.egg-info\SOURCES.txt'
    151. warning: build_py: byte-compiling is disabled, skipping.
    152. running build_ext
    153. generating cffi module 'build\\temp.win-amd64-cpython-39\\Release\\_padding.c'
    154. creating build\temp.win-amd64-cpython-39
    155. creating build\temp.win-amd64-cpython-39\Release
    156. generating cffi module 'build\\temp.win-amd64-cpython-39\\Release\\_constant_time.c'
    157. generating cffi module 'build\\temp.win-amd64-cpython-39\\Release\\_openssl.c'
    158. building '_openssl' extension
    159. creating build\temp.win-amd64-cpython-39\Release\build
    160. creating build\temp.win-amd64-cpython-39\Release\build\temp.win-amd64-cpython-39
    161. creating build\temp.win-amd64-cpython-39\Release\build\temp.win-amd64-cpython-39\Release
    162. "D:\software_download\Microsoft C++ Build Tools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\workProject\2023\7_11\bkom\venv\include -IC:\Users\xuandonglai\AppData\Local\Programs\Python\Python39\include -IC:\Users\xuandonglai\AppData\Local\Programs\Python\Python39\Include "-ID:\software_download\Microsoft C++ Build Tools\VC\Tools\MSVC\14.33.31629\include" "-ID:\software_download\Microsoft C++ Build Tools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcbuild\temp.win-amd64-cpython-39\Release\_openssl.c /Fobuild\temp.win-amd64-cpython-39\Release\build\temp.win-amd64-cpython-39\Release\_openssl.obj
    163. _openssl.c
    164. build\temp.win-amd64-cpython-39\Release\_openssl.c(575): fatal error C1083: 无法打开包括文件: “openssl/opensslv.h”: No such file or directory
    165. error: command 'D:\\software_download\\Microsoft C++ Build Tools\\VC\\Tools\\MSVC\\14.33.31629\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    166. [end of output]
    167. note: This error originates from a subprocess, and is likely not a problem with pip.
    168. ERROR: Failed building wheel for cryptography
    169. ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

            一眼抓关键词 OpenSSL,如果是Windows 64 位系统,下载“Win64 OpenSSL”安装程序

    Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions (slproweb.com)icon-default.png?t=N7T8https://slproweb.com/products/Win32OpenSSL.html        直接安装 openssl 安装包是最快捷方便的方法。

            Win64 OpenSSL 版本下即可,选文件夹。

    Next

    “Select Additional Tasks”,让选择OpenSSL的dll拷贝到什么地方。建议,不要拷贝到系统目录下,如果其他软件使用的OpenSSL版本与你安装这个版本不同,可能导致该软件无法使用。(此解释参考自:http://t.csdn.cn/zDOTd

    然后Install

    没钱(donation就是要你捐钱),啥都不选

    确保环境变量及CMD可访问

    openssl version

  • 相关阅读:
    【JavaEE初阶】进程篇
    WZOI-227我家的门牌号
    上海交通大学计算机考研资料汇总
    报错AttributeError: Attempted to set WANDB to False, but CfgNode is immutable
    C语言之结构体(Struct)
    C++:STL-list模拟实现:迭代器的封装
    QT6.5.2编译PostgreSql驱动
    Feign常用的注解、Http请求调用
    1124:矩阵加法
    Android学习计划
  • 原文地址:https://blog.csdn.net/lxd_max/article/details/132744891