# Setting Python Default Version



## jaymax (Feb 11, 2011)

Hello,

FreeBSD vers 7.2 ; i386 platform

I have several versions of python installed


```
#1736:> ls /usr/local/bin/python*
/usr/local/bin/python*                  /usr/local/bin/python-config*           
/usr/local/bin/python-shared-config*    /usr/local/bin/python-shared2.6*        
/usr/local/bin/python-shared2.7*        /usr/local/bin/python-shared2.7-config* 
/usr/local/bin/python2.6-config*        /usr/local/bin/python2.7*               
/usr/local/bin/python-shared*			/usr/local/bin/python-shared2.6-config*
/usr/local/bin/python2.6*			/usr/local/bin/python2.7-config*
```

And want to make python2.6 as the default version to run


```
#1737:> cat /etc/make.conf
#
# X.Org X-Windows in use
X_WINDOW_SYSTEM=xorg

# added python26 as default 2010-12-02
PYTHON_DEFAULT_VERSION=python2.6

ENABLE_SUIDPERL=true

# added by use.perl 2011-01-11 10:58:01
PERL_VERSION=5.8.9
```


But when I start the python interpreter, I seem to be getting python 2.7 instead


```
#1738:> python
Python 2.7.1 (r271:86832, Dec  2 2010, 09:40:18)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>>
#1739:>
```

Any suggestions?

Thanks!


----------



## wblock@ (Feb 11, 2011)

make.conf does not set the default version to run, just the version to use as a dependency.

/usr/local/bin/python is a hard link.  It may be as simple as whichever python package was installed last overwrites it.


----------



## jaymax (Feb 11, 2011)

OK! I have a program that insists on python 2.6 how do I effect it if I have 2.7 running as the default?


----------



## wblock@ (Feb 11, 2011)

Have it specifically run /usr/local/bin/python2.6.


----------



## jaymax (Feb 11, 2011)

As in finding all calls in program package for python and rewriting as /usr/local/bin/python2.6?


----------



## jaymax (Feb 11, 2011)

BTW: the package has ~70 *.py files, do I have to rewrites all these files? There seems to be an options in the Makefile of the program =>

```
USE_PYTHON=     2.4+
```

Guess I can change it to


```
USE_PYTHON=     2.7+
```

and reinstall?

Thanks!


----------



## wblock@ (Feb 11, 2011)

I was talking about changing the shebang line.

2.4+ should include 2.4 and anything above.  If you would give the name of the mysterious package that requires this, it may be possible to be more specific.


----------



## jaymax (Feb 11, 2011)

```
USE_PYTHON=     2.7+
```
worked!

Or at least part of it did, the first part that is.


----------



## jaymax (Feb 11, 2011)

The "mysterious" package is tmda-1.1.12


----------



## wblock@ (Feb 11, 2011)

How does it require python2.6?  Looks like all that was needed was to rebuild it (mail/tmda), although maybe having multiple versions of python installed interfered.


----------

