How do I run current buffer in python to interactive terminal?

I want to do :pyfile % but print it to terminal, as you’d do :term python3 shellescape(@%).
The reason why I want to use :pyfile instead of running :term python3 is so that Neovim can automatically choose current python provider as the executable.