When I run python it runs version 3.10.4:
$ python
Python 3.10.4 (main, Apr 8 2022, 17:35:13) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[12] Stopped python
When I run python3 it runs version 3.8.10:
$ python3
Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[13] Stopped python3
pip is using python3:
$ head -n1 /usr//bin/pip
#!/usr/bin/python3
How can I change the python path in pip to use python as below?
#!/usr/bin/python
CodePudding user response:
you can define an alias in you .bashrc called python and refer it to where ever you want
alias python=/usr/bin/python3
CodePudding user response:
alias is a solution. Another solution is using -m to run library module.
For example, if you want to run the pip in python, you can:
python -m pip <command> [options]
run the pip in python3, you can:
python3 -m pip <command> [options]
On my laptop:
$ python3 -m pip -V
pip 21.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
$ python -m pip -V
pip 19.3.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
