{"id":9190,"date":"2020-11-19T09:37:02","date_gmt":"2020-11-19T14:37:02","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9190"},"modified":"2021-12-04T07:04:39","modified_gmt":"2021-12-04T07:04:39","slug":"find-python-installation-path-ubuntu-debian-mint","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/find-python-installation-path-ubuntu-debian-mint\/","title":{"rendered":"How to Find the Python Installation Path on Ubuntu, Debian, or Linux Mint"},"content":{"rendered":"\n
There comes a time now and again when you might want to know where your Python installation path on your Ubuntu, Debian<\/a>, or Linux Mint distros is located.<\/p>\n\n\n\n Generally, by default, your Python<\/a> binary is located at \/usr\/bin\/python<\/em> but it may not always be a guarantee depending on the version you are using. As you can see from this post<\/a> you can actually install a different version from the default that comes with your distro.<\/p>\n\n\n\n As with the case with many things on Linux<\/a> systems, there is more than one way to reliably get the Python installation path on that system.<\/p>\n\n\n\n You can get the value of PYTHONPATH only if it has been set. This is an environment variable that is available on the system. If it has not been set then the result of running any one of the commands below will not return anything.<\/p>\n\n\n\n 2. Using grep<\/em><\/p>\n\n\n\n 3. Using printenv<\/em><\/p>\n\n\n\n If the above commands do not work you can also get the path using the which command as shown below.<\/p>\n\n\n\n Once you know the path of the default Python installation path for your system you can permanently add it as an environment variable by opening the startup file you use for your default shell. This is usually ~\/.profile<\/em> in Ubuntu<\/a>.<\/p>\n\n\n\n Open the file in your preferred editor and add the following line at the end of that file.<\/p>\n\n\n\n You then need to restart your terminal to effect the change. You can also run the above on the command-line if you just need it to last the current session.<\/p>\n","protected":false},"excerpt":{"rendered":" There comes a time now and again when you might want to know where your Python installation path on your Ubuntu, Debian, or Linux Mint distros is located. Generally, by…<\/p>\n","protected":false},"author":1,"featured_media":9191,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,16],"tags":[164,193,424,475,531,543,544,598,635,636,638],"yoast_head":"\nGetting the Python Installation Path Using PYTHONPATH<\/h2>\n\n\n\n
$ echo $PYTHONPATH<\/code><\/pre>\n\n\n\n
$ env | grep PYTHONPATH<\/code><\/pre>\n\n\n\n
$ printenv PYTHONPATH<\/code><\/pre>\n\n\n\n
$ which python\n\n\/usr\/bin\/python<\/code><\/pre>\n\n\n\n
Conclusion<\/h2>\n\n\n\n
export PYTHONPATH=\/usr\/bin\/python<\/code><\/pre>\n\n\n\n