我有ubuntu 18.04的docker映像,我正在尝试安装jupyter。
RUN apt-get -y install python3 python3-pip
RUN pip3 --no-cache-dir install --upgrade \
tornado \
jupyterlab \
jupyterhub
RUN /usr/bin/python3 `which jupyter` lab clean && \
/usr/bin/python3 `which jupyter` lab build
但是,在构建图像时,出现以下错误:
Step 4/13 : RUN /usr/bin/python3 `which jupyter` lab clean && jupyter lab build
---> Running in b4a988612018
Traceback (most recent call last):
File "/usr/local/bin/jupyter-lab", line 7, in <module>
from jupyterlab.labapp import main
File "/usr/local/lib/python3.6/dist-packages/jupyterlab/labapp.py", line 14, in <module>
from jupyterlab_server import slugify, WORKSPACE_EXTENSION
File "/usr/local/lib/python3.6/dist-packages/jupyterlab_server/__init__.py", line 4, in <module>
from .app import LabServerApp
File "/usr/local/lib/python3.6/dist-packages/jupyterlab_server/app.py", line 9, in <module>
from .server import ServerApp
File "/usr/local/lib/python3.6/dist-packages/jupyterlab_server/server.py", line 14, in <module>
from notebook.base.handlers import (
File "/usr/local/lib/python3.6/dist-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 605, in <module>
from .extensions import (
File "/usr/local/lib/python3.6/dist-packages/notebook/extensions.py", line 8, in <module>
from tornado.log import LogFormatter
File "/usr/local/lib/python3.6/dist-packages/tornado/log.py", line 34, in <module>
from tornado.escape import _unicode
File "/usr/local/lib/python3.6/dist-packages/tornado/escape.py", line 27, in <module>
from tornado.util import unicode_type
File "/usr/local/lib/python3.6/dist-packages/tornado/util.py", line 18, in <module>
import typing
File "/usr/local/lib/python2.7/dist-packages/typing.py", line 782, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
为什么python3尝试使用python3模块?我该如何摆脱这个错误?