Thursday, November 7, 2013

Install Python 2.7.6 on Centos 6.5 x64


Install requirements
yum -y groupinstall 'Development Tools'
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel wget


Download and compile python 2.7.6
cd /tmp
curl -O http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar xfz Python-2.7.6.tgz
cd Python-2.7.6
./configure --with-threads --enable-shared
make && make altinstall


Configure libraries: (shared libraries: libpython2.7.so.1.0)
ln -s /usr/local/bin/python2.7 /usr/bin/python2.7
echo "/usr/local/lib/python2.7" > /etc/ld.so.conf.d/python27.conf
echo "/usr/local/lib" >> /etc/ld.so.conf.d/python27.conf
ldconfig

Test python2.7
python2.7 
Result : [type exit() to exit]
Python 2.7.6 (default, Dec 23 2013, 17:36:30)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


Install easy_install 2.7, pip 1.4.1 and virtualenv 1.10.1
cd /tmp
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate
sh setuptools-0.6c11-py2.7.egg
easy_install-2.7 pip
easy_install-2.7 virtualenv


Test pip
pip list
Result
pip (1.4.1)
setuptools (0.6c11)
virtualenv (1.10.1)
wsgiref (0.1.2)


Test pip install
pip install crypto
Result
[root@localhost tmp]# pip install crypto
Downloading/unpacking crypto
  Downloading crypto-1.1.0.tar.gz
  Running setup.py egg_info for package crypto

Downloading/unpacking rsa (from crypto)
  Downloading rsa-3.1.2.tar.gz
  Running setup.py egg_info for package rsa

    warning: no files found matching 'README'
Downloading/unpacking pyasn1>=0.1.3 (from rsa->crypto)
  Downloading pyasn1-0.1.7.tar.gz (68kB): 68kB downloaded
  Running setup.py egg_info for package pyasn1

Installing collected packages: crypto, rsa, pyasn1
  Running setup.py install for crypto

  Running setup.py install for rsa

    warning: no files found matching 'README'
    Installing pyrsa-encrypt-bigfile script to /usr/local/bin
    Installing pyrsa-encrypt script to /usr/local/bin
    Installing pyrsa-verify script to /usr/local/bin
    Installing pyrsa-sign script to /usr/local/bin
    Installing pyrsa-priv2pub script to /usr/local/bin
    Installing pyrsa-decrypt script to /usr/local/bin
    Installing pyrsa-keygen script to /usr/local/bin
    Installing pyrsa-decrypt-bigfile script to /usr/local/bin
  Running setup.py install for pyasn1

Successfully installed crypto rsa pyasn1
Cleaning up...
[root@localhost tmp]#


ex01.py (use #!/usr/bin/python2.7 for select python version 2.7)
#!/usr/bin/python2.7
print "windows98SE"

No comments:

Why You Don't LIKE My FaceBook Fanpage ?
×
blogger