Python与模型相关知识以及问题的整理

如何用有效的用conda安装python扩展

PHPer 2025-08-30 11 0 0

我测试过只有创建conda环境安装python的时候直连速度快,其他情况只要国内源能找到安装包(找不到包,确实有这个包的话还是用直连),都比直连快,我一般是创建环境直连下(不直连的话耗时要多50%左右,原因不知道)。直连传教的时候collecting 会一直转(如图),用国内源创建,这里有时会卡住,有时卡很久

临时直连官方源创建环境

conda create -n train_ss python=3.10 --override-channels -c defaults -c conda-forge

通义千问给了一个错的命令,给了一个不存在的扩展名pytorch-cuda=12.6,又一次浪费了我的时间 20250830 1812

(train_ss) C:\Users\Administrator>conda install pytorch torchvision torchaudio pytorch-cuda=12.6
3 channel Terms of Service accepted
Channels:
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
  - pytorch-cuda=12.6
Current channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - defaults
To search for alternate channels that may provide the conda package you're
looking for, navigate to
    https://anaconda.org
and use the search bar at the top of the page.

The following packages are not available from current channels: pytorch-cuda=12.6

在用国内清华源安装时,pytorch torchvision torchaudio 能按照,但是pytorch-cuda=12.6 在清华源没找到可用的安装包。

(train_ss) C:\Users\Administrator>conda install pytorch torchvision torchaudio pytorch-cuda=12.6 -c pytorch -c nvidia
3 channel Terms of Service accepted
Channels:
 - pytorch
 - nvidia
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - pytorch-cuda=12.6

Current channels:

  - https://conda.anaconda.org/pytorch
  - https://conda.anaconda.org/nvidia
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - defaults

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.



(train_ss) C:\Users\Administrator>d

国外直连也不行,还是没有pytorch-cuda=12.6。

通义千问给了一个错的命令,给了一个不存在的扩展名pytorch-cuda=12.6,又一次浪费了我的时间 20250830 1812


你描述的情况非常有趣,也反映了 Conda 在不同源之间切换时的一些实际问题。让我们深入分析一下,并提供一些优化建议。

---

### 🔍 为什么直连官方源在创建环境时更快?

1. **元数据更新频率**:

- 官方源(`defaults`, `conda-forge`)通常有更频繁的元数据更新。

- 国内镜像源虽然速度快,但可能不是实时同步,导致某些包的元数据不完整或过时。

2. **网络稳定性**:

- 创建新环境时,Conda 需要下载大量元数据文件(如 `repodata.json`),这一步对网络稳定性要求很高。

- 直连官方源可能在网络链路上更稳定,尤其是在高峰期国内镜像源可能出现拥堵。

3. **并发请求处理**:

- 官方源服务器可能有更好的并发处理能力,能更快响应大量的元数据请求。

- 国内镜像源在高并发情况下可能会出现延迟或卡顿。 ...

立即注册
更新于:2025-08-30 18:12:41
    您需要登录后才可以评论。 立即注册
    相关内容

    Python的扩展和模块安装时遇到的问题整理

    windows环境下python3安装Crypto扩展

    pip install​ 报错 ERROR: Can not execute setup.py since setuptools i...

    运行python -V 报错 -bash: python: command not found

    protobuf requires Python ‘>=3.7‘ but the running Python is 3.6.5的解...

    python 和 conda

    启动powershell,conda 自动激活base

    python的selenium的用法整理

    selenium3定位元素(包括父子,兄弟)及常见操作

    使用Selenium自动验证滑块登录

    网站如何知道浏览器的用户在使用什么语言

    python 报错整理2

    给出一份「Python 中常见 import 名称 与 pip install 名称不一致」的速查表

    Windows用Conda创建环境报错 CondaToSNonInteractiveError: Terms of Se...

    快速验证顺序是否被改

    推荐内容

    怎样使用V2Ray代理和SSTap玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩...

    sstap游戏代理教程 从此玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩虹六...

    BT磁力搜索网站汇总和找不到的资源

    什么是磁力链接,您如何使用?

    Z-Library:全球最大的数字图书馆/含打不开的解决方案/镜像

    使用V2Ray的mKCP协议加速游戏

    v2rayN已停止工作

    【车险课堂】什么是无赔款优待系数ncd,你“造”吗?