Windows10下用PIP安装Jupyter Notebook报错求助
解决pip安装Jupyter Notebook时的subprocess-exited-with-error错误
问题原因
从报错日志可以明确看到,安装pywinpty包时需要Rust的包管理器Cargo,但你的系统未安装Rust工具链,或者Cargo不在系统PATH中,导致编译失败。
解决方案
方案1:安装Rust工具链
- 下载并运行rustup安装程序,按照提示完成安装
- 重启命令提示符(CMD),确保Cargo被添加到PATH中
- 重新执行安装命令:
pip install jupyter notebook
方案2:安装预编译的pywinpty二进制包(无需编译,更快捷)
这个方法跳过编译步骤,直接使用现成的二进制包:
- 先单独安装pywinpty:
pip install pywinpty==2.0.8 --only-binary :all:
- 再安装Jupyter Notebook:
pip install jupyter notebook
额外建议
之前pip安装时提示Scripts目录不在PATH中,建议把C:\Users\antonis\AppData\Roaming\Python\Python311\Scripts添加到系统环境变量PATH里,这样后续直接输入jupyter notebook就能启动程序,不用每次输入完整路径。
原始报错信息
Microsoft Windows [Version 10.0.19043.2130] (c) Microsoft Corporation. All rights reserved. C:\Users\antonis>cd Desktop C:\Users\antonis\Desktop>python get-pip.py Defaulting to user installation because normal site-packages is not writeable Collecting pip Using cached pip-22.3-py3-none-any.whl (2.1 MB) Collecting wheel Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel, pip WARNING: The script wheel.exe is installed in 'C:\Users\antonis\AppData\Roaming\Python\Python311\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Attempting uninstall: pip Found existing installation: pip 22.3 Uninstalling pip-22.3: Successfully uninstalled pip-22.3 WARNING: The scripts pip.exe, pip3.10.exe, pip3.11.exe and pip3.exe are installed in 'C:\Users\antonis\AppData\Roaming\Python\Python311\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-22.3 wheel-0.37.1 C:\Users\antonis\Desktop>pip install jupyter notebook Defaulting to user installation because normal site-packages is not writeable Collecting jupyter Using cached jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB) Collecting notebook Using cached notebook-6.5.1-py3-none-any.whl (439 kB) Collecting qtconsole Using cached qtconsole-5.3.2-py3-none-any.whl (120 kB) Collecting jupyter-console Using cached jupyter_console-6.4.4-py2.py3-none-any.whl (22 kB) Collecting nbconvert Using cached nbconvert-7.2.2-py3-none-any.whl (271 kB) Collecting ipykernel Using cached ipykernel-6.16.1-py3-none-any.whl (138 kB) Collecting ipywidgets Using cached ipywidgets-8.0.2-py3-none-any.whl (134 kB) Collecting jinja2 Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting tornado>=6.1 Using cached tornado-6.2-cp37-abi3-win_amd64.whl (425 kB) Collecting pyzmq>=17 Using cached pyzmq-24.0.1-cp311-cp311-win_amd64.whl (990 kB) Collecting argon2-cffi Using cached argon2_cffi-21.3.0-py3-none-any.whl (14 kB) Collecting traitlets>=4.2.1 Using cached traitlets-5.5.0-py3-none-any.whl (107 kB) Collecting jupyter-core>=4.6.1 Using cached jupyter_core-4.11.2-py3-none-any.whl (88 kB) Collecting jupyter-client>=5.3.4 Using cached jupyter_client-7.4.3-py3-none-any.whl (132 kB) Collecting ipython-genutils Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB) Collecting nbformat Using cached nbformat-5.7.0-py3-none-any.whl (77 kB) Collecting nest-asyncio>=1.5 Using cached nest_asyncio-1.5.6-py3-none-any.whl (5.2 kB) Collecting Send2Trash>=1.8.0 Using cached Send2Trash-1.8.0-py3-none-any.whl (18 kB) Collecting terminado>=0.8.3 Using cached terminado-0.16.0-py3-none-any.whl (16 kB) Collecting prometheus-client Using cached prometheus_client-0.15.0-py3-none-any.whl (60 kB) Collecting nbclassic==0.4.5 Using cached nbclassic-0.4.5-py3-none-any.whl (9.8 MB) Collecting jupyter-server>=1.8 Using cached jupyter_server-1.21.0-py3-none-any.whl (346 kB) Collecting notebook-shim>=0.1.0 Using cached notebook_shim-0.2.0-py3-none-any.whl (13 kB) Collecting entrypoints Using cached entrypoints-0.4-py2.py3-none-any.whl (5.3 kB) Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\antonis\appdata\roaming\python\python311\site-packages (from jupyter-client>=5.3.4->notebook) (2.8.2) Collecting pywin32>=1.0 Using cached pywin32-304-cp311-cp311-win_amd64.whl (12.1 MB) Collecting beautifulsoup4 Using cached beautifulsoup4-4.11.1-py2.py3-none-any.whl (128 kB) Collecting bleach Using cached bleach-5.0.1-py3-none-any.whl (160 kB) Collecting defusedxml Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB) Collecting jupyterlab-pygments Using cached jupyterlab_pygments-0.2.2-py2.py3-none-any.whl (21 kB) Collecting markupsafe>=2.0 Using cached MarkupSafe-2.1.1.tar.gz (18 kB) Preparing metadata (setup.py) ... done Collecting mistune<3,>=2.0.3 Using cached mistune-2.0.4-py2.py3-none-any.whl (24 kB) Collecting nbclient>=0.5.0 Using cached nbclient-0.7.0-py3-none-any.whl (71 kB) Requirement already satisfied: packaging in c:\users\antonis\appdata\roaming\python\python311\site-packages (from nbconvert->jupyter) (21.3) Collecting pandocfilters>=1.4.1 Using cached pandocfilters-1.5.0-py2.py3-none-any.whl (8.7 kB) Collecting pygments>=2.4.1 Using cached Pygments-2.13.0-py3-none-any.whl (1.1 MB) Collecting tinycss2 Using cached tinycss2-1.2.1-py3-none-any.whl (21 kB) Collecting fastjsonschema Using cached fastjsonschema-2.16.2-py3-none-any.whl (22 kB) Collecting jsonschema>=2.6 Using cached jsonschema-4.16.0-py3-none-any.whl (83 kB) Collecting pywinpty>=1.1.0 Using cached pywinpty-2.0.8.tar.gz (23 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Cargo, the Rust package manager, is not installed or is not on PATH. 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.... [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
内容的提问来源于stack exchange,提问作者Antonis
相关产品推荐
相关产品推荐

