2012-02-19 14 views
8

Estoy tratando de instalar la aplicación node, pero de forma predeterminada en mi entorno es python 3, y requiere python 2.6. ¿Cómo puedo cambiar la versión predeterminada de python en FreeBSD?¿Cómo configurar la versión de Python por defecto en FreeBSD?

# cd /usr/local/bin 
# ls -l | grep python 
-r-xr-xr-x 2 root wheel 1246256 Jul 12 2011 python 
-r-xr-xr-x 2 root wheel  1401 Jul 12 2011 python-config 
-r-xr-xr-x 2 root wheel  6060 Jul 12 2011 python-shared 
-r-xr-xr-x 2 root wheel  1408 Jul 12 2011 python-shared-config 
-r-xr-xr-x 1 root wheel  3720 Jul 12 2011 python-shared2.6 
-r-xr-xr-x 1 root wheel  1431 Jul 12 2011 python-shared2.6-config 
-r-xr-xr-x 2 root wheel  6060 Jul 12 2011 python-shared3.1 
-r-xr-xr-x 2 root wheel  1408 Jul 12 2011 python-shared3.1-config 
-r-xr-xr-x 1 root wheel 1182056 Jul 12 2011 python2.6 
-r-xr-xr-x 1 root wheel  1424 Jul 12 2011 python2.6-config 
-r-xr-xr-x 2 root wheel 1246256 Jul 12 2011 python3.1 
-r-xr-xr-x 2 root wheel  1401 Jul 12 2011 python3.1-config 

Respuesta

3

Podría quitar /usr/local/bin/python y crear un enlace simbólico a Python 2.6:

rm /usr/local/bin/python 
ln -s /usr/local/bin/python2.6 /usr/local/bin/python 
+2

¡Esto se debe rehacer después de cada actualización del pitón predeterminado! El objetivo posterior a la instalación en el archivo make del puerto vincula fuertemente los binarios específicos de la versión con los binarios sin versión. –

-1
mv python python.old 

ln -s /usr/bin/pythonX.X /usr/bin/python 

en X.X escribir su versión

21

Debe eliminar la pitón meta-puerto /usr/ports/lang/python. asentando después la siguiente variable en /etc/make.conf:

PYTHON_DEFAULT_VERSION='python3.2' 

(... Si desea que la última versión alternativa, también se puede utilizar python3.1 En la actualidad, el valor predeterminado es python2.7)

Ahora instale /usr/ports/lang/python nuevo. ¡Tenga en cuenta que los puertos pueden solicitar otra versión de python!

Actualización: Desde octubre de 2013, existe una nueva forma de configurar las versiones predeterminadas;

20131003: 
    AFFECTS: users of lang/python* and ports 
    AUTHOR: [email protected] 

    The default versions of lang/python* have been changed to support the 
    new DEFAULT_VERSIONS variable. 

    PYTHON_DEFAULT_VERSION, PYTHON2_DEFAULT_VERSION and 
    PYTHON3_DEFAULT_VERSION are deprecated. If you have set them in your 
    make.conf, you should change them something like 

    DEFAULT_VERSIONS=python=2.7 python2=2.7 python3=3.3 
+0

¡Gracias por actualizar tu respuesta! Sabía que esto había cambiado y estaba a punto de buscar nuevamente la respuesta cuando vi la parte actualizada de su respuesta. –

Cuestiones relacionadas