【问题标题】:I get an error while installing ipykernel on vscode在 vscode 上安装 ipykernel 时出现错误
【发布时间】:2022-11-01 16:31:59
【问题描述】:

当我在 vscode 上运行 jupyter note 时

`

# Load the libraries to be used in the Analysis

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
impor wat warnings

# Setup libraries settings and options
## Pandas setup
pd.set_option('display.max_columns', None)

## matplotlib setup
%matplotlib inline

## Seaborn setup
sns.set_context('notebook')
sns.set_style('whitegrid')
sns.set_palette('Blues_r')

# turn off warning for final notebook
warnings.filterwarnings('ignore')

`

然后我被要求安装 ipykernel,当我从 vscode 选择安装时,进程开始,然后我收到以下错误消息: 使用“Python 3.11.0 64-bit”运行单元需要 ipykernel 包。 运行以下命令将“ipykernel”安装到 Python 环境中。 命令:'c:/Users/Samir/AppData/Local/Programs/Python/Python311/python.exe -m pip install ipykernel -U --user --force-reinstall'

我去 Git Bash 并运行

python -m pip install ipykernel

我得到这个错误

\tests
      running build_ext
      building 'psutil._psutil_windows' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Micr
osoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tool
s/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem wit
h pip.
  ERROR: Failed building wheel for psutil
Failed to build psutil
ERROR: Could not build wheels for psutil, which is required to install pyproject
.toml-based projects

我尝试从 vscode 然后从 Git bash 安装 ipykernel,但出现错误

【问题讨论】:

  • 您是否尝试过消息中的建议? c:/Users/Samir/AppData/Local/Programs/Python/Python311/python.exe -m pip install ipykernel -U --user --force-reinstall。事实上,它还建议从visualstudio.microsoft.com/visual-cpp-build-tools 获取编译器
  • 我在windows 中使用vs code,它在vs code 内的提示符下工作。我相信它会安装jupyter 扩展...

标签: python visual-studio-code pip jupyter-notebook


【解决方案1】:

'c:/Users/Samir/AppData/Local/Programs/Python/Python311/python.exe -m pip install ipykernel -U --user --force-reinstall'

显然,它已经告诉您如何安装。

但请注意,这是一个环境问题,因此请确保您选择了正确的口译员。

你可以使用快捷键Ctrl+Shift+打开一个新的VScode终端,它会自动进入当前选择的VSCode环境。

并使用命令pip install ipykernel 安装 ipykernel。

替代方法:

在终端中使用以下命令重新安装 pyzmq 包。

pip uninstall pyzmq
pip install pyzmq

【讨论】:

    猜你喜欢
    • 2023-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-22
    • 2016-02-25
    • 2017-04-19
    • 1970-01-01
    相关资源
    最近更新 更多