【问题标题】:How to fix errors occurring on installation of Jupyter Notebook?如何修复安装 Jupyter Notebook 时出现的错误?
【发布时间】:2021-07-24 08:35:33
【问题描述】:

我是 Python 新手,尝试在 Windows 命令提示符窗口中安装 Jupyter Notebook

pip install jupyter

但是下载几分钟后,会显示如下错误信息:

  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe
' 'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\
_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\asd\Ap
pData\Local\Temp\tmpnj_hhq6y'
         cwd: C:\Users\asd\AppData\Local\Temp\pip-install-_pnki5r8\pywinpty
    Complete output (6 lines):

    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....
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\asd\appdata\local\progr
ams\python\python38-32\python.exe' 'c:\users\asd\appdata\local\programs\python\p
ython38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata
_for_build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpnj_hhq6y' Check the logs for
full command output.
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.

我在这里只附上了错误输出的最后一部分。

如何解决此错误以成功安装 Jupyter Notebook


EDIT1:我从错误消息中的链接安装了 Rust 包。之后我再次尝试安装 Jupyter Notebook,这一次在比之前更进一步的步骤之后,它输出了另一个错误:

Building wheels for collected packages: pywinpty
  Building wheel for pywinpty (PEP 517) ... -  WARNING: Subprocess output does
not appear to be encoded as cp1252
  WARNING: Subprocess output does not appear to be encoded as cp1252
error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe'
'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\_v
endor\pep517\_in_process.py' build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpaj5
u66_y'
       cwd: C:\Users\asd\AppData\Local\Temp\pip-install-mep4ye8d\pywinpty
  Complete output (60 lines):
  Running `maturin pep517 build-wheel -i c:\users\asd\appdata\local\programs\pyt
hon\python38-32\python.exe`
     Compiling proc-macro2 v1.0.26
     Compiling unicode-xid v0.2.2
     Compiling syn v1.0.71
     Compiling winapi v0.3.9
     Compiling jobserver v0.1.22
  error: could not compile `proc-macro2`

  To learn more, run the command again with --verbose.
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  dY'¥ maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit code: 101": `cargo rustc --messag
e-format json --manifest-path Cargo.toml --release --lib --`
  dY\x8d1 Building a mixed python/rust project
  dY"- Found pyo3 bindings
  dY\x90\x8d Found CPython 3.8 at c:\users\asd\appdata\local\programs\python\pyt
hon38-32\python.exe
  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'c:\\users\\asd\\app
data\\local\\programs\\python\\python38-32\\python.exe'] returned non-zero exit
status 1
  ----------------------------------------
  ERROR: Failed building wheel for pywinpty
Failed to build pywinpty
ERROR: Could not build wheels for pywinpty which use PEP 517 and cannot be insta
lled directly
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.

【问题讨论】:

标签: python installation cmd pip jupyter-notebook


【解决方案1】:

pip install wheel

然后再试一次。它对我有用。

【讨论】:

    【解决方案2】:

    先升级你的点子:

    pip install --upgrade pip
    

    然后:

    pip install jupyter
    

    【讨论】:

    • 这对我也有用。但我还需要通过 python 运行 pip: python -m pip install --upgrade pip
    【解决方案3】:

    32-bit python 3.8.3 执行时未能安装 notebook 后,我到达了这篇文章。据我发现,pywinpty 是一个依赖项,不支持 32 位 执行(参见下面的来源)。

    我通过在 64 位版本上安装 python 解决了这个问题。

    来源:

    How do I determine if my python shell is executing in 32bit or 64bit?

    pip install fails on Python 3.8 32-bit, prevents Jupyter install #129

    We can't generate 32 bit wheels, sorry. Please use a 64bit build of Python.

    不是我的情况,但在使用 python 3.8 64-bit 时可能会对这个类似的问题有用

    Error installing Jupyter & pywinpty (Python)

    https://github.com/spyder-ide/pywinpty/issues/123

    【讨论】:

      【解决方案4】:

      尝试使用 Anaconda。安装 conda 的链接https://www.anaconda.com/products/individual 然后 cmd : conda install numpy cmd:康达安装jupyter cmd : jupyter 笔记本

      【讨论】:

        【解决方案5】:

        错误信息看起来很清楚,你需要通过https://rustup.rs/安装Cargo

        【讨论】:

        • 我按照链接安装,但我仍然收到其他错误,因为我在编辑中附加了
        猜你喜欢
        • 2021-09-06
        • 2020-08-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-10-24
        • 1970-01-01
        • 1970-01-01
        • 2020-07-17
        相关资源
        最近更新 更多