Cybersecurity-Tools / V2W-BERT

Software Vulnerabilities to Weakness Mapping
Other
23 stars 8 forks source link

Error in File "PrepareDataset.py", line 76 #2

Open darrinh opened 1 year ago

darrinh commented 1 year ago

Error message when attempting to run in Python: 3.8.16 instead of 3.7

python PrepareDataset.py --dir='Dataset' --from_year=2020 --to_year=2021 --from_train_year=1990 --to_train_year=2020 --from_test_year=2021 --to_test_year=2021 --from_val_year=2022 --to_test_year=2022

Results in:

Traceback (most recent call last):
  File "PrepareDataset.py", line 76, in <module>
    from pandas.io.json import json_normalize
ImportError: cannot import name 'json_normalize' from 'pandas.io.json' (/home/darrin/Source/V2W-BERT/lib/python3.8/site-packages/pandas/io/json/__init__.py)

Fix:

Change line 76 to:

from pandas import json_normalize

19231219lsm commented 2 months ago

May I ask if you have successfully run this program? I kindly request your reply

尝试在 Python 中运行时出现错误消息:3.8.16 而不是 3.7

python PrepareDataset.py --dir='Dataset' --from_year=2020 --to_year=2021 --from_train_year=1990 --to_train_year=2020 --from_test_year=2021 --to_test_year=2021 --from_val_year=2022 --to_test_year=2022

结果:

Traceback (most recent call last):
  File "PrepareDataset.py", line 76, in <module>
    from pandas.io.json import json_normalize
ImportError: cannot import name 'json_normalize' from 'pandas.io.json' (/home/darrin/Source/V2W-BERT/lib/python3.8/site-packages/pandas/io/json/__init__.py)

使固定:

将第 76 行更改为:

from pandas import json_normalize

May I ask if you have successfully run this program? I kindly request your reply