栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

2021-09-29

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021-09-29

Dockerfile 配置linux 环境、python
# 基础镜像使用cuda
FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 
 
# 配置程序依赖环境 
RUN apt-get update && apt-get install -y --no-install-recommends  
         build-essential  
         cmake  
         curl  
         ca-certificates  
         libjpeg-dev  
 	 libglib2.0-dev 
	 libgl1-mesa-glx 
	 openssl 
	 libssl-dev 
         libpng-dev &&
     rm -rf /var/lib/apt/lists/* &&
	apt-get purge -y python.*

# 删除旧的 python
# RUN apt-get purge -y python.*

# 使用 UTF-8 编码
ENV LANG C.UTF-8

ENV PYTHON_VERSION 3.6.5

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''"
ENV PYTHON_PIP_VERSION 21.1.3
# 将程序复制容器内,表示在/workspace 路径下 
COPY .  /workspace 

RUN set -ex 
        # && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz 
        && mkdir -p /usr/src/python 
        && tar -xJC /usr/src/python --strip-components=1 -f /workspace/python.tar.xz 
	&& rm /workspace/python.tar.xz 
        
        && cd /usr/src/python 
        && ./configure --enable-shared --enable-unicode=ucs4 
        && make -j$(nproc) 
        && make install 
        && ldconfig 
        && pip3 install --no-cache-dir --upgrade --ignore-installed pip==$PYTHON_PIP_VERSION 
        && find /usr/local -depth 
                ( 
                    ( -type d -a -name test -o -name tests ) 
                    -o 
                    ( -type f -a -name '*.pyc' -o -name '*.pyo' ) 
                ) -exec rm -rf '{}' + 
        && rm -rf /usr/src/python ~/.cache

# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin 
        && ln -s easy_install-3.5 easy_install 
        && ln -s idle3 idle 
        && ln -s pydoc3 pydoc 
        && ln -s python3 python 
        && ln -s python3-config python-config 

RUN   pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 
	&& pip install tqdm joblib numpy scikit-learn scipy 

# 确定容器启动时程序运行路径 
WORKDIR /workspace 
# 确定容器启动命令。以python 示例,python 表示编译器,
CMD ["python"]
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/275596.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号