Альтернативы преобразованию скрипта в Python 3.x: как в этом случае исправить проблемы совместимости с Python 2.7?Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Альтернативы преобразованию скрипта в Python 3.x: как в этом случае исправить проблемы совместимости с Python 2.7?

Сообщение Anonymous »


I am running a script written by someone else as a replication. The original script and all the files were created with Python 2.7. I have three scripts: 'prediction_2021', 'performance_2020' and my current script 'prediction' which runs xgboost. I was running everything on a Python 2.7 virtual environment but the XGBoost package stopped working, so I tried to update everything to run it in Python 3.11 in MacOS. 'prediction_2021' and 'performance_2020' both load pickle and other types files of files and the file won't load in Python 3.11, I tried saving it in different formats (CSV, YAML, JSON) but when I tried to load it, I get different errors. This is the usage of the first two scripts in my third script:

from prediction_2021 import get_pred, preprocess_data from performance_2020 import get_bootstrap, chunks, aggregated_performance_table I have two questions:
  • Is there anyway I can use XGBoost package in Python 2.7 now that the support is dropped?
  • Is my only option to just try to rewrite the first two scripts to read the files in some format in Python 3.11?

I tried saving the files in different formats and just correcting the reading parts in the original two scripts. I also tried to restart and reload the packages in my virtual environment. Thanks.


Источник: https://stackoverflow.com/questions/780 ... -7-compati
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»