You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装cdqa时遇torch==1.2.0版本匹配错误,求解决方法

Fixing the "torch==1.2.0 not found" Error When Installing cdqa

Yep, I've dealt with this exact headache before when setting up cdqa! The core issue is that cdqa has a hard dependency on an older version of PyTorch (1.2.0), which isn't available via standard PyPI for newer Python versions or some system architectures. Here's how to fix it:

1. Verify Your Python Version First

Torch 1.2.0 only supports Python 3.6 or 3.7 — it won't work with Python 3.8 or later. Run this command to check your current version:

python --version

If you're on a newer Python version, create a virtual environment with Python 3.7 to avoid breaking other projects. For example, using conda:

conda create -n cdqa_env python=3.7
conda activate cdqa_env

Or with venv if you prefer:

python3.7 -m venv cdqa_env
source cdqa_env/bin/activate  # On macOS/Linux
cdqa_env\Scripts\activate     # On Windows

2. Install torch==1.2.0 Directly from PyTorch's Repository

Even with the right Python version, standard PyPI might not have the wheel for your system. Install torch 1.2.0 using this command (it pulls from PyTorch's official wheel store):

pip install torch==1.2.0 -f https://download.pytorch.org/whl/torch_stable.html

Once torch is installed, you can then safely run:

pip install cdqa

3. Fallback: Install cdqa Without Strict Dependencies (Risky but Functional)

If you can't use Python 3.7 (e.g., your system doesn't support it), you can install cdqa without enforcing its dependency constraints, then install a newer compatible torch version. Note: This might cause some minor compatibility issues, but it works for most core features.

First, install cdqa without dependencies:

pip install cdqa --no-deps

Then install the required dependencies manually (use a recent torch version that works with your Python):

pip install torch transformers==2.8.0 pandas numpy scikit-learn

That should get you up and running with cdqa without the version mismatch error!

内容的提问来源于stack exchange,提问作者roney

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 20:27:49