ubuntu 镜像 python 镜像

  • 永久修改,一劳永逸:

Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

==============================

sudo vim /etc/apt/sources.list
 

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

sudo apt-get update

转载于:https://my.oschina.net/sskill/blog/3045611

UbuntuPython 和 Docker 都是非常流行的技术栈组件,在软件开发中有着广泛的应用。如果你想在一个 Docker 容器中运行基于 UbuntuPython 应用,首先你需要做的就是下载对应的 Docker 镜像。 1. **Docker 镜像基础**:Docker 提供了一个庞大的官方仓库(Docker Hub),其中包含了各种预构建的基础镜像,如 Ubuntu 的官方镜像(`ubuntu`)和 Python 的基础镜像(例如 `python:latest`, `python:3.x` 等)。你可以通过命令行访问这些镜像。 示例: ``` docker pull ubuntu # 下载最新版的 Ubuntu 镜像 docker pull python # 或者下载 Python 镜像 ``` 2. **安装 Python**:如果你需要的是包含 Python镜像,可以直接拉取,因为很多基础镜像已经预装了不同版本的 Python。如果镜像中没有安装特定版本的 Python,可以在容器启动时或 Dockerfile 中添加安装步骤。 3. **自定义镜像**:如果你想要创建一个定制化的镜像,可以从官方镜像开始,并添加额外的 Python 包或其他配置。可以通过 Dockerfile 来定义这个过程,文件里会列出一系列命令来安装所需软件。 ```dockerfile # 使用官方的 Ubuntu 基础镜像 FROM ubuntu # 更新系统并安装 Python RUN apt-get update && apt-get install -y python3 # 添加你的 Python 库或代码 COPY your_python_code /app # 设置环境变量等其他配置 CMD ["python", "/app/main.py"] ``` 然后,运行 `docker build -t my-python-app .` 来构建你的镜像
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值