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

pip依赖冲突求助:pennylane与protobuf版本不兼容问题

解决pip依赖冲突问题

错误信息:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

pennylane-sf 0.29.1 requires pennylane=0.19, but you have pennylane 0.31.0 which is incompatible.
cirq-google 1.1.0 requires protobuf=3.15.0, but you have protobuf 4.23.3 which is incompatible.
paddle-quantum 2.4.0 requires protobuf=3.1.0, but you have protobuf 4.23.3 which is incompatible.


方案一:用虚拟环境隔离(最推荐)

不同项目依赖分开管理,从根源避免冲突:

# 创建虚拟环境(myenv可自定义名称)
python -m venv myenv

# Windows系统激活虚拟环境
myenv\Scripts\activate

# macOS/Linux系统激活虚拟环境
source myenv/bin/activate

# 激活后重新安装所需包,pip会自动处理兼容版本
pip install pennylane-sf cirq-google paddle-quantum

方案二:手动调整依赖版本匹配

解决pennylane与pennylane-sf的冲突

直接降级pennylane到指定兼容版本:

pip install pennylane==0.19.0

解决protobuf的冲突

由于cirq-google和paddle-quantum对protobuf版本要求不一致,优先尝试升级这两个包到最新版,看是否支持兼容的protobuf版本:

# 升级cirq-google到最新版
pip install --upgrade cirq-google

# 升级paddle-quantum到最新版
pip install --upgrade paddle-quantum

如果升级后仍冲突,只能选择保留其中一个包,卸载另一个:

# 示例:卸载cirq-google(若你不需要它)
pip uninstall cirq-google

方案三:卸载无用的冲突包

如果你根本不需要某个引发冲突的包,直接卸载即可消除对应冲突:

# 示例:卸载pennylane-sf
pip uninstall pennylane-sf

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 08:52:48