Python: Difference between revisions
No edit summary |
No edit summary Tag: Manual revert |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
To work around this issue, you can create a symlink or use alternatives to redirect the /usr/bin/python command to the version of Python installed on your server. | To work around this issue, you can create a symlink or use alternatives to redirect the /usr/bin/python command to the version of Python installed on your server. | ||
==Use alternatives to redirect your python command to Python 3== | ===Use alternatives to redirect your python command to Python 3=== | ||
On AlmaLinux, Rocky Linux, and CloudLinux 9 servers, to use alternatives to redirect the python command to Python 3, run the following command: | On AlmaLinux, Rocky Linux, and CloudLinux 9 servers, to use alternatives to redirect the python command to Python 3, run the following command: | ||
<pre> | |||
alternatives --install /usr/bin/python python /usr/bin/python3 1 | |||
</pre> | |||
===Use symlinks to redirect your python command to Python 3=== | |||
==Use symlinks to redirect your python command to Python 3== | |||
On AlmaLinux, Rocky Linux, Ubuntu, and CloudLinux 9 servers, to create a symlink to redirect the python command to Python 3, run the following command: | On AlmaLinux, Rocky Linux, Ubuntu, and CloudLinux 9 servers, to create a symlink to redirect the python command to Python 3, run the following command: | ||
<pre> | <pre> | ||
ln -s /usr/bin/python3 /usr/bin/python | ln -s /usr/bin/python3 /usr/bin/python | ||
</pre> | </pre> | ||
Latest revision as of 11:48, 20 June 2024
python: command not found
If you’re getting "python: command not found" on Almanlinux 9, Python 2 is now end of life and many systems now use Python 3, the python command does not always refer to the correct version of Python. While many systems create an alias for the python command that refers to a specific version of Python, this alias may not point to the correct version of Python for your system.
To work around this issue, you can create a symlink or use alternatives to redirect the /usr/bin/python command to the version of Python installed on your server.
Use alternatives to redirect your python command to Python 3
On AlmaLinux, Rocky Linux, and CloudLinux 9 servers, to use alternatives to redirect the python command to Python 3, run the following command:
alternatives --install /usr/bin/python python /usr/bin/python3 1
Use symlinks to redirect your python command to Python 3
On AlmaLinux, Rocky Linux, Ubuntu, and CloudLinux 9 servers, to create a symlink to redirect the python command to Python 3, run the following command:
ln -s /usr/bin/python3 /usr/bin/python