VSCode not picking up ipykernel

自作多情 提交于 2020-12-13 07:05:26

问题


I'm trying to use vscode with jupyter via the python extension. My pipfile looks like this:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
opencv-python = "*"

[requires]
python_version = "3.6"

[dev-packages]
ipykernel = "*"
ipython = "*"
jupyter = "*"

To start the ipython interpreter i follow these steps:

  • $ pipenv install
  • $ pipenv shell
  • $ code .
  • using the Python: Select interpreter, i select the pipenv environment
  • run code

when i got to the code block by pressing shift + enter, i see the errors:

Code block:

#%%
import cv2

I have also tried using all dependencies in the [packages] section, reinstalling my pipenv from scratch, and repeating the above process.

Always the same error, what am i missing?

$ code -v
1.41.1
26076a4de974ead31f97692a0d32f90d735645c0
x64


回答1:


Turns out that the python I had installed python3.6, but not python3.6-dev.

You can install this using:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update -y && sudo apt upgrade
sudo apt install python3.6 python3.6-dev

Upon opening vscode i then hit ctrl + shift + P and selected Python: Select Interpreter and selected the virtual env containing ipykernel.



来源:https://stackoverflow.com/questions/60100344/vscode-not-picking-up-ipykernel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!