[英]Python kernel not found by vscode when running docker container
我正在尝试构建一个 docker 图像来调试一个在 vscocde 中有很多奇怪依赖项的模块。
我正在使用下面的 dockerfile 来构建图像:
FROM ubuntu:20.04
USER root
RUN apt update -y && apt upgrade -y && \
apt install -y software-properties-common && \
add-apt-repository ppa:ubuntugis/ppa && \
apt update -y && apt install -y \
gdal-bin \
geotiff-bin \
git \
libgdal-dev \
libgl1 \
libspatialindex-dev \
wget \
python-is-python3 \
pip \
g++
RUN pip install Cython numpy
RUN git clone https://github.com/jgrss/geowombat.git
RUN pip install -r /geowombat/requirements.txt
RUN pip install sklearn-xarray pip-tools rtree ipykernel
RUN python -c "import geowombat as gw"
RUN python -c "import rasterio;from rasterio.crs import CRS; cc = CRS.from_epsg(4326)"
当以交互方式运行图像时(如我的测试所示),我可以成功运行:
python
但是,当我使用 vscode 远程容器和 docker 扩展来“附加 vscode”或使用shift+cntr+p
运行Remote-Containers: Attach to running container
我无法通过在.py
文件中执行代码来访问 python,如果我尝试使用.ipynb
,它会通知我需要从“市场”安装 python kernel。
基本上,vscode似乎没有连接到默认的python kernel。
我对此很陌生,所以任何建议都会有所帮助!
你可以尝试根据文档创建和更新一个dockerfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.