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

Brightway导入Ecospold2格式Ecoinvent数据库触发ValueError问题求助

Brightway导入Ecospold2格式Ecoinvent数据库触发ValueError问题求助

我最近在尝试用Brightway导入Ecospold2格式的Ecoinvent数据库,但反复触发ValueError,尝试调整数据库名称、确认目录路径都没解决问题,实在摸不着头绪,想请教社区的各位大佬有没有遇到过类似情况,或者能给我一些排查方向?

我使用的核心代码如下:

dirpath = 'ecoinvent'

# 尝试导入Ecoinvent 3.10
ei310 = bw2.SingleOutputEcospold2Importer(dirpath, "ecoinvent 3.10")
ei310.apply_strategies()
ei310.statistics()
ei310.write_database()

实际运行时,我也测试过导入旧版本(比如"ecoinvent 3.6 conseq"),但都会在初始化SingleOutputEcospold2Importer的步骤触发报错,完整的报错回溯信息如下:

ValueError                                Traceback (most recent call last)
Cell In[106], line 1
----> 1 ei310 = bw2.SingleOutputEcospold2Importer(dirpath, "ecoinvent 3.6 conseq")
2 ei310.apply_strategies()
3 ei310.statistics()

File /opt/anaconda3/envs/brightway-env/lib/python3.9/site-packages/bw2io/importers/ecospold2.py:133, in SingleOutputEcospold2Importer.__init__(self, dirpath, db_name, biosphere_database_name, extractor, use_mp, signal, reparametrize_lognormals, add_product_information)
...
769     return self._value
770 else:
--> 771     raise self._value

ValueError:

奇怪的是ValueError后面没有给出具体的错误描述,这让我很难定位问题根源。目前我已经确认:

  • dirpath指向的目录确实包含所有Ecospold2格式的XML文件
  • 我的运行环境是Anaconda创建的专属虚拟环境(Python 3.9,Brightway相关依赖均为官方推荐的稳定版本)
  • 已经尝试过关闭多进程导入(修改use_mp=False参数),但问题依旧

有没有人能帮我分析可能的原因,或者提供一些具体的排查步骤?

备注:内容来源于stack exchange,提问作者Christy Selvam

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 15:34:32