I tried to compile Python 2.7 from source.
Here are my commands:
./configure --prefix=/my/local/dir --exec-prefix=/my/local/dir --enable-shared --with-pydebug
make
make install
And the output of which python is /my/local/dir/bin/python, which is correct.
But when I ran python --version I see Python 2.7.3 instead of Python 2.7.10.
The system version of Python is 2.7.3. Could it be the system version of Python somehow links itself against the local, compiled version? Or am I doing something wrong?
Edit:
The output of ./my/local/dir/bin/python --version is also Python 2.7.3
Edit 2:
Seems like if I get rid of the --enable-shared flag it will produce the correct version of Python, but I need that flag for my other software to work.
/my/local/dir/bin/python --version? If this case is correct, then your shell is simply caching the location ofpython, as o11c mentioned.Python 2.7.3whichis implemented as a program instead of a shell builtin and might not tell you what the shell will really run. Best to look at whatever command tells you what the shell really thinks. Forbash, that command istype. Look athelp typefor more.type pythonstill gives the same resulthash -rwould clear it). You might also want to trytype -a pythonwhich will list all the pythons on your path, in order.