Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  100] [ 0]  / answers: 1 / hits: 734688  / 3 Years ago, wed, august 25, 2021, 11:16:49

I have just migrated from Windows environment. I have installed Python 3.2 in a separate directory. How can I get the python installation path in Ubuntu shell?



Is there any way I can let the shell know/choose at runtime which python version is to be used for further code execution?



Are there any environment variables and search path kind of things in Ubuntu Linux as well?


More From » 12.04

 Answers
0

First question:



which python though its usually /usr/bin/python for the 2.7



Second question:



From a terminal & python2.7: python2.7 yourfile.py.
Simailarly for 3.2: python3.2 yourfile.py though 3.2 isn't installed by default. (You can apt-get install python3.2.)



What python yourfile.py will do depends on which alternative is used for your python interpreter. You can change that by issuing update-alternatives python as root (or by using su).



Third question:



Environment variables are shell dependent, though you can write them out with echo $variable and set them with variable=value (from bash). The search path is simply called PATH and you can get yours by typing echo $PATH.



I hope this was helpful.


[#32445] Thursday, August 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ippalogu

Total Points: 215
Total Questions: 127
Total Answers: 146

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
ippalogu questions
Tue, Jan 4, 22, 21:49, 2 Years ago
Tue, Sep 21, 21, 09:12, 3 Years ago
Wed, May 19, 21, 02:24, 3 Years ago
Mon, Dec 27, 21, 01:44, 2 Years ago
;