我在装有 ubuntu 20.04.1 LTS 的电脑上工作,我的 python 版本是 3.8.5
我正在尝试使用以下 Dockerfile 构建 docker 映像
FROM ros:kinetic-robot
LABEL maintainer="[email protected]"
# Install Dataspeed DBW from binary
# adding Dataspeed server to apt
RUN sh -c 'echo "deb [ arch=amd64 ] http://packages.dataspeedinc.com/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-dataspeed-public.list'
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FF6D3CDA
RUN apt-get update
# setup rosdep
RUN sh -c 'echo "yaml http://packages.dataspeedinc.com/ros/ros-public-'$ROS_DISTRO'.yaml '$ROS_DISTRO'" > /etc/ros/rosdep/sources.list.d/30-dataspeed-public-'$ROS_DISTRO'.list'
RUN rosdep update
RUN apt-get install -y ros-$ROS_DISTRO-dbw-mkz
RUN apt-get upgrade -y
# end installing Dataspeed DBW
# install python packages
RUN apt-get install -y python-pip
RUN pip install --upgrade pip
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
# install required ros dependencies
RUN apt-get install -y ros-$ROS_DISTRO-cv-bridge
RUN apt-get install -y ros-$ROS_DISTRO-pcl-ros
RUN apt-get install -y ros-$ROS_DISTRO-image-proc
# socket io
RUN apt-get install -y netbase
RUN mkdir /capstone
VOLUME ["/capstone"]
VOLUME ["/root/.ros/log/"]
WORKDIR /capstone/ros
但是,安装要求时失败:
attrdict==2.0.0
gevent==1.4.0
gevent-websocket==0.10.1
h5py==2.6.0
python-engineio==3.11.2
python-socketio==4.4.0
numpy==1.13.1
Pillow==2.2.1
scipy==0.19.1
keras==2.0.8
tensorflow==1.3.0
ujson==1.35
wsaccel==0.6.2
特别是在尝试安装 numpy 时。
在安装要求之前,它会显示此消息
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
为什么?我在哪一部分指定了 Python 2.7?
答案1
哦,你会喜欢这个的:你需要在你的 Dockerfile 中使用python3-pip
和。pip3
使用时,apt install python-pip
您正在安装 Python 2.7 版本的 pip。希望这个问题能在不久的将来得到解决,因为 Python 2.x 的运行已经到达 EOL。
希望这能满足您的需求