Unable to run ansible-playbook after installed ansible-core

pip3 install ansible-core

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see pypa/pip#5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with ‘-m pip’ instead of running pip directly.
Requirement already satisfied: ansible-core in ./.local/lib/python3.6/site-packages (2.11.7)
Requirement already satisfied: jinja2 in ./.local/lib/python3.6/site-packages (from ansible-core) (3.0.3)
Requirement already satisfied: PyYAML in ./.local/lib/python3.6/site-packages (from ansible-core) (6.0)
Requirement already satisfied: cryptography in ./.local/lib/python3.6/site-packages (from ansible-core) (39.0.0)
Requirement already satisfied: packaging in ./.local/lib/python3.6/site-packages (from ansible-core) (21.3)
Requirement already satisfied: resolvelib<0.6.0,>=0.5.3 in ./.local/lib/python3.6/site-packages (from ansible-core) (0.5.4)
Requirement already satisfied: cffi>=1.12 in ./.local/lib/python3.6/site-packages (from cryptography->ansible-core) (1.15.1)
Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.6/site-packages (from jinja2->ansible-core) (2.0.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in ./.local/lib/python3.6/site-packages (from packaging->ansible-core) (3.0.9)
Requirement already satisfied: pycparser in ./.local/lib/python3.6/site-packages (from cffi>=1.12->cryptography->ansible-core) (2.21)

ansible --version

-bash: ansible: command not found

Why are you installing ansible as the root user? The root user typically does not have “.local/bin” in its PATH.

If your operating system has ansible-core packages, use those. RHEL 8 or later have ansible-core 2.14, with all the dependences, already bundled as a more gracefully integrated RPM.