No Red Hat Enterprise Linux 6.2 como posso usar o Python 2.7 como padrão, não o Python 2.6? Eu fiz, mas ainda mostrando 2,6?

3

RHEL 6.2 Eu tenho o python 2.6, mas eu preciso do padrão python 2.7 usando yum packaging (para que nada fique bagunçado, porque é um sistema de trabalho pesado, tudo o que preciso é o python 2.7, sem bagunçar).

Eu fiz o seguinte, mas ainda vejo python versão como 2.6, qualquer ponteiro para isso, por favor?

$ cat /etc/issue
Red Hat Enterprise Linux Server release 6.2 (Santiago)
Kernel \r on an \m

$ python --version
Python 2.6.6

$ sudo sh -c 'wget -qO- http://people.redhat.com/bkabrda/scl_python27.repo >> /etc/yum.repos.d/scl.repo'

$ yum search python27
Loaded plugins: amazon-id, rhui-lb, security
scl_python27                                                                                                                                      | 2.9 kB     00:00     
scl_python27/primary_db                                                                                                                           |  38 kB     00:00     
========================================================================= N/S Matched: python27 =========================================================================
python27.i686 : Package that installs python27
python27.x86_64 : Package that installs python27
python27-expat-debuginfo.i686 : Debug information for package python27-expat
python27-expat-debuginfo.x86_64 : Debug information for package python27-expat
python27-python-coverage-debuginfo.i686 : Debug information for package python27-python-coverage
python27-python-coverage-debuginfo.x86_64 : Debug information for package python27-python-coverage
python27-python-debuginfo.i686 : Debug information for package python27-python
python27-python-debuginfo.x86_64 : Debug information for package python27-python
python27-python-markupsafe-debuginfo.i686 : Debug information for package python27-python-markupsafe
python27-python-markupsafe-debuginfo.x86_64 : Debug information for package python27-python-markupsafe
python27-python-simplejson-debuginfo.i686 : Debug information for package python27-python-simplejson
python27-python-simplejson-debuginfo.x86_64 : Debug information for package python27-python-simplejson
python27-python-sqlalchemy-debuginfo.i686 : Debug information for package python27-python-sqlalchemy
python27-python-sqlalchemy-debuginfo.x86_64 : Debug information for package python27-python-sqlalchemy
python27-runtime.i686 : Package that handles python27 Software Collection.
python27-runtime.x86_64 : Package that handles python27 Software Collection.
python27-babel.noarch : Tools for internationalizing Python applications
python27-build.i686 : Package shipping basic build configuration
python27-build.x86_64 : Package shipping basic build configuration
python27-expat.i686 : An XML parser library
python27-expat.x86_64 : An XML parser library
python27-expat-devel.i686 : Libraries and header files to develop applications using expat
python27-expat-devel.x86_64 : Libraries and header files to develop applications using expat
python27-expat-static.i686 : expat XML parser static library
python27-expat-static.x86_64 : expat XML parser static library
python27-python.i686 : An interpreted, interactive, object-oriented programming language
python27-python.x86_64 : An interpreted, interactive, object-oriented programming language
python27-python-babel.noarch : Library for internationalizing Python applications
python27-python-coverage.i686 : Code coverage testing module for Python
python27-python-coverage.x86_64 : Code coverage testing module for Python
python27-python-debug.i686 : Debug version of the Python runtime
python27-python-debug.x86_64 : Debug version of the Python runtime
python27-python-devel.i686 : The libraries and header files needed for Python development
python27-python-devel.x86_64 : The libraries and header files needed for Python development
python27-python-docutils.noarch : System for processing plaintext documentation
python27-python-jinja2.noarch : General purpose template engine
python27-python-libs.i686 : Runtime libraries for Python
python27-python-libs.x86_64 : Runtime libraries for Python
python27-python-markupsafe.i686 : Implements a XML/HTML/XHTML Markup safe string for Python
python27-python-markupsafe.x86_64 : Implements a XML/HTML/XHTML Markup safe string for Python
python27-python-nose.noarch : Discovery-based unittest extension for Python
python27-python-nose-docs.noarch : Nose Documentation
python27-python-pygments.noarch : Syntax highlighting engine written in Python
python27-python-setuptools.noarch : Easily build and distribute Python packages
python27-python-simplejson.i686 : Simple, fast, extensible JSON encoder/decoder for Python
python27-python-simplejson.x86_64 : Simple, fast, extensible JSON encoder/decoder for Python
python27-python-sphinx.noarch : Python documentation generator
python27-python-sphinx-doc.noarch : Documentation for python-sphinx
python27-python-sqlalchemy.i686 : Modular and flexible ORM library for python
python27-python-sqlalchemy.x86_64 : Modular and flexible ORM library for python
python27-python-test.i686 : The test modules from the main python package
python27-python-test.x86_64 : The test modules from the main python package
python27-python-tools.i686 : A collection of development tools included with Python
python27-python-tools.x86_64 : A collection of development tools included with Python
python27-python-virtualenv.noarch : Tool to create isolated Python environments
python27-python-werkzeug.noarch : The Swiss Army knife of Python web development
python27-python-werkzeug-doc.noarch : Documentation for python-werkzeug
python27-tkinter.i686 : A graphical user interface for the Python scripting language
python27-tkinter.x86_64 : A graphical user interface for the Python scripting language

EDITAR: (opção alternativa que também tentei da seguinte forma):

#!/bin/bash
# Install Python 2.7.3 alternatively
yum groupinstall "development tools" -y
yum install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel tk tix gcc-c++ libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel valgrind-devel -y

mkdir tmp
cd tmp
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar xvfz Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/opt/python2.7 --enable-shared
make
make altinstall
echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf
ldconfig
cd ..
cd ..
rm -rf tmp


[root@ip-10-59-143-73 bin]# pwd
/opt/python2.7/bin
[root@ip-10-59-143-73 bin]# tree
.
├── 2to3
├── idle
├── pydoc
├── python2.7
├── python2.7-config
└── smtpd.py

0 directories, 6 files
[root@ip-10-59-143-73 bin]# ./python2.7 --version
Python 2.7.3

[root@ip-10-59-143-73 bin]# python --version
Python 2.6.6
    
por YumYumYum 27.05.2013 / 20:09

3 respostas

4

Em vez de mexer no Python em nível de sistema, sugiro usar algo como virtualenv junto com virtualenvwrapper . Juntas, essas 2 ferramentas tornam bastante trivial manter suas próprias cópias locais de bibliotecas Python + em vez de tentar manter a instalação em nível de sistema do Python em um estado OK para o software em nível de sistema que o requer.

virtualenv

virtualenv é uma ferramenta para criar ambientes Python isolados.

It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed libraries either).

virtualenvwrapper

virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.

A maioria das linguagens fornece esses tipos de ferramentas agora. Veja o meu post sobre esta questão intitulada: Distribuição recomendada do Linux para estatísticas? para outros idiomas também.

    
por 27.05.2013 / 20:39
2

Estou usando o Python 2.7.4 no RedHat 6.4 para computação científica. A maneira mais fácil de instalá-lo é usar enthought distribuição em Python (EPD), que instala binários pré-compilados na sandbox. Ele preenche os menus do gnome de acordo. Você também pode editar o seu perfil (eu uso o ksh) e definir o caminho para o Python, em vez do sistema um. Use links suaves se precisar em algum aplicativo específico. O EPD é gratuito para uso acadêmico. Se você precisar de produção, sugiro que você compre uma licença ou jogue com sua própria sandbox. De qualquer maneira não vai ser livre.

Editar: NÃO atrapalhe o sistema Python. Yum é escrito em Python. RedHat não pode funcionar sem Python!

    
por 27.05.2013 / 23:11
2

A abordagem suportada pela Red Hat para instalar versões mais recentes do Python em versões do RHEL é da Red Hat Software Collections: link

O RHSCL 2.0 inclui o Python 2.7.8 e 3.4.2.

Para usuários do CentOS, o envio para o RHSCL está no link

    
por 09.10.2015 / 05:55