Don't mix homebrew with the Python3 installation (3.12.3) from Python.org.
Regardless of whether you are using Bash or Zsh for the SHELL, your PATH statement should reflect:
export PATH=".:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/bin:${PATH}"
Because homebrew inherently installs the Apple Command Line tools, there will be a crippled Python 3.9.6 installed into /usr/bin/python3 — and without the correct PATH statement to avoid using that version of Python, you will incur headaches. Any pip3 installations using Apple's Python stores those results in ~/Library/Python/3.9/lib/site-packages.
The Python.org installer will link the binaries from the framework into /usr/local/bin. That is where homebrew would also like to place its Python3 dependencies, but will not do so when the Python 3.12.3 binaries are already there per the Python.org installer.
I have a local folder ~/py_projects in which I create Python virtual environments (e.g. env312) for version-specific installations. MrHoffman has demonstrated that invocation for you. To jump into your virtual environment, and by example, how I do it locally from the SHELL prompt:
source ~/py_projects/env312/bin/activate && cd ~/py_projects/env312
pip3 install -U pip
︙
deactivate