安装docker的conda环境和代码包

1. 构建docker环境:配置Dockerfile

FROM registry.cn-hangzhou.aliyuncs.com/ant666/jar:1.8
MAINTAINER liupeng <895876294@qq.com>

RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 

RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && rm -rf Miniconda3-latest-Linux-x86_64.sh

RUN /opt/conda/bin/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
RUN /opt/conda/bin/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main 
RUN /opt/conda/bin/conda config --set show_channel_urls yes

ADD svc-alg.yaml /opt/conda/

RUN /opt/conda/bin/conda env create -f /opt/conda/svc-alg.yaml && /opt/conda/bin/conda clean --all

2. 安装python运行环境和工具包

a) 导出安装工具包,需要注意:导出的工具包不能带有构建信息,参考命令如下。

conda env export -n [环境名称] --no-builds -f svc-alg.yaml 

导出文件参考如下:

name: svc-alg
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - conda-forge
  - anaconda
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
dependencies:
  - _tflow_select=2.2.0
  - abseil-cpp=20211102.0
  - absl-py=1.3.0
  - aiohttp=3.8.3
  - aiosignal=1.2.0
  - appdirs=1.4.4
  - astunparse=1.6.3
  - async-timeout=4.0.2
  - attrs=22.1.0
  - backports=1.0
  - backports.zoneinfo=0.2.1
  - blas=1.0
  - blinker=1.4
  - brotli=1.0.9
  - brotli-bin=1.0.9
  - brotlipy=0.7.0
  - c-ares=1.19.0
  - ca-certificates=2022.12.7
  - cachetools=4.2.2
  - certifi=2022.12.7
  - cffi=1.15.1
  - charset-normalizer=2.0.4
  - click=8.0.4
  - clickhouse-driver=0.2.5
  - contourpy=1.0.7
  - cryptography=39.0.1
  - cycler=0.11.0
  - flatbuffers=2.0.0
  - flit-core=3.6.0
  - fonttools=4.39.2
  - freetype=2.12.1
  - frozenlist=1.3.3
  - gast=0.4.0
  - giflib=5.2.1
  - google-auth=2.6.0
  - google-auth-oauthlib=0.4.4
  - google-pasta=0.2.0
  - grpc-cpp=1.46.1
  - grpcio=1.42.0
  - h5py=3.7.0
  - hdf5=1.10.6
  - icu=58.2
  - idna=3.4
  - importlib-metadata=6.0.0
  - importlib-resources=5.12.0
  - importlib_resources=5.12.0
  - intel-openmp=2021.4.0
  - joblib=1.2.0
  - jpeg=9e
  - keras=2.10.0
  - keras-preprocessing=1.1.2
  - kiwisolver=1.4.4
  - krb5=1.19.4
  - lcms2=2.15
  - lerc=3.0
  - libbrotlicommon=1.0.9
  - libbrotlidec=1.0.9
  - libbrotlienc=1.0.9
  - libcurl=7.88.1
  - libcxx=14.0.6
  - libdeflate=1.17
  - libedit=3.1.20221030
  - libev=4.33
  - libffi=3.4.2
  - libgfortran5=11.3.0
  - libnghttp2=1.46.0
  - libpng=1.6.39
  - libprotobuf=3.20.3
  - libssh2=1.10.0
  - libtiff=4.5.0
  - libwebp=1.2.4
  - libwebp-base=1.2.4
  - llvm-openmp=14.0.6
  - lz4-c=1.9.4
  - markdown=3.4.1
  - markupsafe=2.1.1
  - matplotlib=3.7.1
  - matplotlib-base=3.7.1
  - mkl=2021.4.0
  - mkl-service=2.4.0
  - mkl_fft=1.3.1
  - mkl_random=1.2.2
  - multidict=6.0.2
  - munkres=1.1.4
  - ncurses=6.4
  - numpy=1.23.5
  - numpy-base=1.23.5
  - oauthlib=3.2.1
  - openssl=1.1.1t
  - opt_einsum=3.3.0
  - packaging=23.0
  - pandas=1.5.3
  - patsy=0.5.3
  - pillow=9.4.0
  - pip=23.0.1
  - pooch=1.4.0
  - protobuf=3.20.3
  - pyasn1=0.4.8
  - pyasn1-modules=0.2.8
  - pycparser=2.21
  - pyjwt=2.4.0
  - pyopenssl=23.0.0
  - pyparsing=3.0.9
  - pysocks=1.7.1
  - python=3.8.16
  - python-dateutil=2.8.2
  - python-flatbuffers=2.0
  - python-tzdata=2022.7
  - python_abi=3.8
  - pytz=2022.7.1
  - pytz-deprecation-shim=0.1.0.post0
  - re2=2022.04.01
  - readline=8.2
  - requests=2.28.1
  - requests-oauthlib=1.3.0
  - rsa=4.7.2
  - scikit-learn=1.2.1
  - scipy=1.10.0
  - setuptools=65.6.3
  - six=1.16.0
  - snappy=1.1.9
  - sqlite=3.41.1
  - statsmodels=0.13.5
  - tensorboard=2.10.0
  - tensorboard-data-server=0.6.1
  - tensorboard-plugin-wit=1.6.0
  - tensorflow=2.10.0
  - tensorflow-base=2.10.0
  - tensorflow-estimator=2.10.0
  - termcolor=2.1.0
  - threadpoolctl=3.1.0
  - tk=8.6.12
  - tornado=6.2
  - typing_extensions=4.4.0
  - tzdata=2022g
  - tzlocal=4.2
  - unicodedata2=15.0.0
  - urllib3=1.26.14
  - werkzeug=2.2.2
  - wheel=0.35.1
  - wrapt=1.14.1
  - xz=5.2.10
  - yarl=1.8.1
  - zipp=3.11.0
  - zlib=1.2.13
  - zstd=1.5.2
  - libgfortran=3.0.0
prefix: /opt/conda/envs/svc-alg

b) 执行环境的安装,参考Dockerfile中的安装命令。

c) 注意:不同的操作系统的安装包版本可能会不一样,需要根据操作系统或平台选择不同版本的安装包。例如:libgfortran工具包在mac系统中版本是5.0.0,在linux-64中的版本为3.0.0。安装包的版本查询参考:https://anaconda.org/

在安装过程中,如果找不到指定版本的安装包,报错如下。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ant-666

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值