问题
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