联网问题
1.设置proxy
参看主机的代理端口,查看软件上的系统设置里的。
LINUX:export http_proxy = <主机ip>:<port>
export https_proxy = <主机ip>:<port>
WINDOWS:set http_proxy = <主机ip>:<port>
set https_proxy = <主机ip>:<port>
2.tun模式
如果使用的是clash的话,可以打开tun模式,该模式会虚拟网卡,实际效果类似软路由,整台电脑都能被加速。
3.使用proxychains
参考https://zhuanlan.zhihu.com/p/166375631
git
1.换clone地址
例如git clone https://github.com/google/autofdo.git
替换为git clone https://gitclone/github.com/google/autofdo.git
缺点:只能作用于最外层,如果这个.git包含别的.git,内层的会下不动。
2.设置config
git config --global url."https://gitclone.com/github.com/".insteadOf "https://github.com/"
缺点:因为是全局置换,所以如果想 push 到 github 会有困难。
pip
其他方法只有换源pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
conda
其他方法只有换源
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ && \
conda config --set show_channel_urls yes
apt
其他方法只有换源sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
Dockerfile
如果希望全部换好源的docker,以下是一个模板
# 使用官方的 Ubuntu 镜像作为基础
FROM ubuntu:latest
# Using aliyun ubuntu mirror
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
# 安装依赖软件包
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
bzip2 \
ca-certificates \
libglib2.0-0 \
libxext6 \
libsm6 \
libxrender1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 下载并安装 Anaconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
bash miniconda.sh -b -p /opt/conda && \
rm miniconda.sh
# 将 conda 加入系统 PATH
ENV PATH="/opt/conda/bin:${PATH}"
# 安装git
RUN apt-get install -y git
# git换源
RUN git config --global url."https://gitclone.com/github.com/".insteadOf "https://github.com/"
# conda换源
RUN conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ && \
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ && \
conda config --set show_channel_urls yes
#pip换源
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 将 conda 加入bash
RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate faser" >> ~/.bashrc
CMD ["echo", "Hello"]
分类:
MIT 6.1810 lab
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类