development

CentOS에 Python 2.6 설치

big-blog 2020. 9. 15. 18:54
반응형

CentOS에 Python 2.6 설치


CentOS를 실행하는 셸이 있습니다.

내가하고있는 프로젝트의 경우 파이썬 2.5 이상이 필요하지만 centOS는 2.4에 상당히 의존합니다.

내가 읽은 바에 따르면 2.5로 업그레이드하면 여러 가지 문제가 발생합니다.

2.4와 2.5를 별도로 설치하고 싶지만 어떻게해야할지 모르겠습니다. 지금까지 소스 tarball을 다운로드하고 압축을 푼 다음 ./configure --prefix=/opt끝낼 위치를 지정했습니다. 이제 그냥 할 수 있습니까 make, make install? 아니면 더 있습니까?


EPEL-repository 를 사용한 다음 sudo yum install python26Python 2.6을 설치할 수도 있습니다.


epel 시도

wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo rpm -ivh epel-release-5-4.noarch.rpm
sudo yum install python26

파이썬 실행 파일은 /usr/bin/python26

mkdir -p ~/bin
ln -s /usr/bin/python26 ~/bin/python
export PATH=~/bin:$PATH # Append this to your ~/.bash_profile for persistence

이제 python명령이 실행됩니다.python 2.6


비슷한 상황에 처했을 때 일반적으로 패키지 관리자를 피합니다. 특히 프로덕션 서버와 같은 무언가를 깨는 것이 부끄러 울 경우에는 특히 그렇습니다. 대신 Activestate로 이동하여 바이너리 패키지를 다운로드합니다.

https://www.activestate.com/activepython/downloads/

이것은 모든 것을 폴더에 배치하고 시스템 파일을 건드리지 않는 스크립트를 실행하여 설치됩니다. 사실, 설정하는 데 루트 권한도 필요하지 않습니다. 그런 다음 바이너리 이름을 apy26과 같은 이름으로 변경하고 해당 폴더를 PATH 끝에 추가하고 코딩을 시작합니다. apy26 setup.py installvirtualenv 및 easyinstall을 사용 하여 패키지를 설치 하거나 사용하는 경우 시스템 표준 Python을 건드리지 않고도 필요한만큼의 유연한 Python 환경을 갖게됩니다.

편집 ... 최근에 외부 종속성없이 모든 배포판에서 실행되어야하는 Linux 용 이식 가능한 Python 바이너리를 빌드하기위한 작업을 수행했습니다. 즉, 이식 가능한 Python 모듈에 필요한 바이너리 공유 라이브러리는 빌드의 일부이며 tarball에 포함되고 Python의 개인 디렉터리 구조에 설치됩니다. 이렇게하면 시스템에 설치된 Python을 방해하지 않고 애플리케이션에 Python을 설치할 수 있습니다.

내 github 사이트 에는 32 비트 및 64 비트 설치 모두 Ubuntu Lucid 10.04 LTS에서 철저히 테스트 된 빌드 스크립트가 있습니다. Debian Etch에서도 빌드했지만 얼마 전 일이어서 변경하지 않았다는 것을 보장 할 수 없습니다. 가장 쉬운 방법은 Ubuntu Lucid를 가상 머신에 넣고 스크립트를 체크 아웃 한 다음 스크립트 git clone git://github.com/wavetossed/pybuild.git를 실행하는 것입니다.

빌드 한 후에는 최신 Linux 배포판에서 tarball을 사용하십시오. 디렉토리 를 이동하기 전에 인터프리터 경로를 설정하기 /data1/packages/python272위해 포함 된 디렉토리 를 실행해야한다는 것 외에 다른 디렉토리로 이동하는 데 약간의 주름 이 있습니다 patchelf. 이것은 모든 바이너리에 영향을 미칩니다./data1/packages/python272/bin

이 모든 것은 RUNPATH로 빌드하고 종속 공유 라이브러리를 복사하는 것을 기반으로합니다. 스크립트가 여러 파일에 있지만 사실상 /etc/rc.d 디렉토리의 스타일로 배열 된 하나의 긴 쉘 스크립트입니다.


yum을 수행하거나 자신의 RPM을 만들 필요가 없습니다. python26소스에서 빌드하십시오 .

wget https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
tar -zxvf Python-2.6.6.tgz
cd Python-2.6.6
./configure && make && make install

종속성 오류 사용 이있을 수 있습니다.

yum install gcc cc

에 설치 경로 ( /usr/local/bin/python기본값)를 추가합니다 ~/.bash_profile.

그것은 깨지지 않을 yum것입니다 python24.


아니, 그게 다야. 나중에 다시 컴파일 할 필요가 없도록 모든 선택적 라이브러리 헤더가 설치되어 있는지 확인하는 것이 좋습니다. 그것들은 내가 생각하는 문서에 나열되어 있습니다.

Also, you can install it even in the standard path if you do make altinstall. That way it won't override your current default "python".


Chris Lea provides a YUM repository for python26 RPMs that can co-exist with the 'native' 2.4 that is needed for quite a few admin tools on CentOS.

Quick instructions that worked at least for me:

$ sudo rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
$ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
$ sudo yum install python26
$ python26

If you want to make it easier on yourself, there are CentOS RPMs for new Python versions floating around the net. E.g. see:

http://www.geekymedia.com/python_26_centos.html


When you install your python version (in this case it is python2.6) then issue this command to create your virtualenv:

virtualenv -p /usr/bin/python2.6 /your/virtualenv/path/here/

Late to the party, but the OP should have gone with Buildout or Virtualenv, and sidestepped the problem completely.

I am currently working on a Centos server, well, toiling away would be the proper term and I can assure everyone that the only way I am able to blink back the tears whilst using the software equivalents of fire hardened spears, is buildout.


you can always make your own RPM:

http://www.grenadepod.com/2009/12/26/building-python-2-6-4-rpm-for-centos-5-4/


Missing Dependency: libffi.so.5 is here :

ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/libffi-3.0.5-1.el5.kb.i386.rpm


rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
rpm -Uvh ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/libffi-3.0.5-1.el5.kb.i386.rpm
yum install python26
python26

for dos that just dont know :=)


# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

Download and install Python 3.3.0

# wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2
# tar xf Python-3.3.0.tar.bz2
# cd Python-3.3.0
# ./configure --prefix=/usr/local
# make && make altinstall

Download and install Distribute for Python 3.3

# wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
# tar xf distribute-0.6.35.tar.gz
# cd distribute-0.6.35
# python3.3 setup.py install

Install and use virtualenv for Python 3.3

# easy_install-3.3 virtualenv
# virtualenv-3.3 --distribute otherproject

New python executable in otherproject/bin/python3.3
Also creating executable in otherproject/bin/python
Installing distribute...................done.
Installing pip................done.

# source otherproject/bin/activate
# python --version
Python 3.3.0

I unistalled the original version of python (2.6.6) and install 2.7(with option make && make altinstall) but when I tried install something with yum didn't work.

So I solved this issue as follow:

  1. # ln -s /usr/local/bin/python /usr/bin/python
  2. Download the RPM package python-2.6.6-36.el6.i686.rpm from http://rpm.pbone.net/index.php3/stat/4/idpl/20270470/dir/centos_6/com/python-2.6.6-36.el6.i686.rpm.html
  3. Execute as root rpm -Uvh python-2.6.6-36.el6.i686.rpm

Done


Type the following commands on the terminal to install Python 3.6 on CentOS 7:

$ sudo yum install https://centos7.iuscommunity.org/ius-release.rpm

Then do :

$ sudo yum install python36u 

You can also install any version instead of 3.6 (if you want to) by just replacing 36 by your version number.

참고URL : https://stackoverflow.com/questions/1465036/install-python-2-6-in-centos

반응형