Ubuntu安装依赖库太慢 pip.conf

本文介绍了一种通过更换pip源来加速依赖库下载的方法。具体步骤包括:创建或进入~/.pip目录;创建或编辑pip.conf文件;配置新的index-url及trusted-host。此方法适用于希望提高caffe框架等依赖库下载速度的用户。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

打算安装caffe框架但是下载依赖库太慢了,网上说换pip源,但是没具体说怎么找到pip.conf

打开终端,输入 cd ~/.pip

如果没有这个文件夹,自己创一个,输入mkdir ~/.pip

cd ~/.pip

创建或者修改pip.conf文件 创建则输入:touch pip.conf

修改则输入:sudo gedit ~/.pip/pip.conf

复制粘贴以下代码到pip.conf文件中:

[global] 
index-url = http://pypi.douban.com/simple 
[install] 

trusted-host=mirrors.aliyun.com

这样就替换成功了

fast@fast:~/lhc/highway_ai$ cat Dockerfile FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 WORKDIR /app RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list && \ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3.10 python3-pip git build-essential cmake ninja-build && \ rm -rf /var/lib/apt/lists/* RUN mkdir -p /root/.pip && \ echo "[global]" > /root/.pip/pip.conf && \ echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> /root/.pip/pip.conf COPY requirements.txt ./ RUN pip3 install --upgrade pip && \ pip3 install setuptools wheel packaging ninja RUN pip3 install torch==2.7.1 RUN pip3 install flash-attn --no-build-isolation RUN pip3 install fastapi==0.100.0 uvicorn[standard]==0.23.1 transformers>=4.35.0 Pillow>=9.0.0 COPY . ./ EXPOSE 8000 ENV API_KEY="111111" CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] 编译太慢了 => [ 8/10] RUN pip3 install flash-attn --no-build-isolation 1627.7s => => # Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch->flash-attn) (3.0.2) => => # Building wheels for collected packages: flash-attn => => # DEPRECATION: Building 'flash-attn' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use => => # the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'flash-attn'. Discussion can => => # be found at https://github.com/pypa/pip/issues/6334 => => # Building wheel for flash-attn (setup.py): started 我的这个应该怎么修改?
07-11
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值