python

关注公众号 jb51net

关闭
首页 > 脚本专栏 > python > Python安装jupyter notebook报pywinpty缺少Rust和Cargo

Python安装jupyter notebook报pywinpty缺少Rust和Cargo问题

作者:星空椰

文章介绍了在安装pip install jupyter时遇到的错误,并分析了原因,错误是由于缺少Rust和Cargo编译扩展,作者通过访问rustup.rs下载并安装Rust,并确保将Rust添加到系统路径中,重启电脑后成功解决了问题

问题描述

Python 执行安装 pip install jupyter 命令报这个错误:

ERROR: Command errored out with exit status 1:
command: 'e:\XXX\python\python.exe' 'e:\XXX\python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\xxx\AppData\Local\Temp\tmpg764gw5c'
cwd: C:\Users\xxx\AppData\Local\Temp\pip-install-cmivv4zn\pywinpty
Complete output (6 lines):

This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/

Checking for Rust toolchain....
----------------------------------------
ERROR: Command errored out with exit status 1: 'e:\XXX\python\python.exe' 'e:\XXX\python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\xxx\AppData\Local\Temp\tmpg764gw5c' Check the logs for full command output.

原因分析

因为缺少 Rust 和 Cargo 导致的,我先后用了升级 pip 和 setuptools都没有解决

python -m pip install --upgrade pip
python -m pip install --upgrade pip

重新用命令安装这个包也不成功,都可以试试

pip install --upgrade pywinpty

解决方案

访问 rustup.rs - The Rust toolchain installer ,按照网站上的指示下载并安装 Rust。

安装过程中,确保选择将 Rust 添加到系统路径中,以便在命令行中可以访问 rustccargo

重启电脑后再次执行就可安装成功了

pip install jupyter

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文