Building wheel for scrypt (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for scrypt (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [38 lines of output] C:\Users\dcfea\AppData\Local\Temp\pip-build-env-hensmotg\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: OSI Approved :: BSD License See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-313\scrypt copying scrypt\scrypt.py -> build\lib.win-amd64-cpython-313\scrypt copying scrypt\__init__.py -> build\lib.win-amd64-cpython-313\scrypt creating build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\test_scrypt.py -> build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\test_scrypt_c_module.py -> build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\test_scrypt_py3x.py -> build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\__init__.py -> build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\ciphertexts.csv -> build\lib.win-amd64-cpython-313\scrypt\tests copying scrypt\tests\hashvectors.csv -> build\lib.win-amd64-cpython-313\scrypt\tests running build_ext building '_scrypt' extension creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\lib\crypto creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\lib\scryptenc creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\lib\util creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\libcperciva\alg creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\libcperciva\crypto creating build\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\libcperciva\util creating build\temp.win-amd64-cpython-313\Release\scrypt-windows-stubs creating build\temp.win-amd64-cpython-313\Release\src cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHAVE_CONFIG_H -Dinline=__inline -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -Ic:\OpenSSL-Win64\include -Iscrypt-windows-stubs/include -IE:\Plug-ins\mtkclient-2.0.1.freeze\myenv\include "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1520.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1520.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcscrypt-1.2.1/lib/crypto/crypto_scrypt.c /Fobuild\temp.win-amd64-cpython-313\Release\scrypt-1.2.1\lib\crypto\crypto_scrypt.obj error: command 'cl.exe' failed: None [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for scrypt Failed to build scrypt ERROR: Failed to build installable wheels for some pyproject.toml based projects (scrypt)
时间: 2025-06-19 16:53:42 浏览: 14
### 解决在 Windows 系统上安装 `scrypt` 库时出现的编译错误
在 Windows 系统上安装 `scrypt` 库时,如果遇到与 OpenSSL 或 Visual Studio 构建工具相关的编译错误,通常是因为缺少必要的依赖项或环境配置不正确。以下是解决该问题的详细方法:
---
#### 1. 确保安装了正确的 Visual Studio 构建工具
`scrypt` 的安装需要使用 C++ 扩展进行编译,因此必须确保系统中已安装适合 Python 版本的 Microsoft Visual C++ Build Tools[^1]。可以从以下链接下载并安装最新版本的 Visual Studio 构建工具:
- 官方下载地址:[Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
安装时选择“C++ build tools”工作负载,并确保包含以下组件:
- MSBuild
- Windows SDK
- C++ CMake 工具[^2]
---
#### 2. 安装预编译的 OpenSSL 包
`scrypt` 依赖于 OpenSSL 提供的加密功能。如果系统中未正确安装 OpenSSL,可能会导致编译失败。可以通过以下步骤安装预编译的 OpenSSL 版本:
访问 Shining Light Productions 的官方网站或其镜像站点,下载适合系统的 OpenSSL 版本。例如,对于 64 位 Windows 系统,可以选择 `Win64 OpenSSL v1.1.x`[^3]。
解压下载的文件后,将其安装到指定目录(如 `C:\OpenSSL`)。然后将以下路径添加到系统的环境变量 `PATH` 中:
```plaintext
C:\OpenSSL\bin
```
同时,设置以下环境变量以确保编译器能够找到 OpenSSL 的库和头文件:
```plaintext
set LIB=C:\OpenSSL\lib;%LIB%
set INCLUDE=C:\OpenSSL\include;%INCLUDE%
```
---
#### 3. 配置 pip 使用预编译二进制包
为了避免从源代码编译 `scrypt`,可以尝试安装预编译的二进制轮文件(wheel)。运行以下命令以安装适合当前平台的 `scrypt` 轮文件:
```python
pip install scrypt --only-binary :all:
```
如果官方 PyPI 仓库中没有适合的二进制包,可以尝试从第三方仓库获取,例如 [Unofficial Windows Binaries for Python Extension Packages](https://www.lfd.uci.edu/~gohlke/pythonlibs/#scrypt)。下载对应版本的 `.whl` 文件后,使用以下命令安装:
```python
pip install path_to_downloaded_whl_file.whl
```
---
#### 4. 检查 Python 和编译器版本兼容性
Python 3.13 是一个较新的版本,可能尚未完全支持某些依赖库的编译。建议检查以下内容以确保兼容性:
- 确认 `setuptools` 和 `wheel` 已更新到最新版本:
```python
pip install --upgrade setuptools wheel
```
- 如果仍然无法成功安装,可以尝试降级到 Python 3.10 或 3.11,这些版本的生态系统更为成熟且兼容性更高[^4]。
---
#### 5. 手动编译 `scrypt`
如果上述方法均无效,可以手动编译 `scrypt` 源代码。首先克隆 `scrypt` 的 GitHub 仓库:
```bash
git clone https://github.com/holgern/py-scrypt.git
cd py-scrypt
```
然后运行以下命令进行编译和安装:
```python
python setup.py build
python setup.py install
```
编译过程中可能会提示缺少某些依赖项,请根据错误信息逐一解决。
---
#### 6. 验证安装是否成功
安装完成后,可以运行以下代码验证 `scrypt` 是否正常工作:
```python
import scrypt
print(scrypt.__version__)
```
如果输出显示版本号,则说明安装成功。
---
### 注意事项
- 确保所有环境变量设置正确,并且路径中没有拼写错误或多余的空格[^5]。
- 如果仍然遇到问题,可能是因为 Python 编译时未链接到正确的 OpenSSL 版本。在这种情况下,建议重新编译 Python 并明确指定 OpenSSL 的路径[^6]。
---
阅读全文
相关推荐


















