[转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only

Okay for centos 6.4 also On apu.0xdata.loc, after this install was done

$ which python
/usr/local/bin/python

$ python -V
Python 2.7.3

$ ls -ltr /usr/local/bin/pyth*
lrwxrwxrwx 1 root root 24 Jan 30 2013 /usr/local/bin/python -> /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 6162289 Sep 3 00:59 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 1624 Sep 3 01:00 /usr/local/bin/python2.7-config


So yum will use ‘/usr/bin/python‘ which is 2.6

$ /usr/bin/python -V
Python 2.6.6

"python" will give you python 2.7.

"python2.7" will give you python 2.7.

"easy_install" and "easy_install-2.7" will easy install for python 2.7. While
separate files, they both seem to install into
/usr/local/lib/python2.7/site-packages/

$ ls -ltr /usr/local/bin | grep easy_
-rwxr-xr-x 1 root root 340 Jan 30 2013 easy_install-2.7
-rwxr-xr-x 1 root root 332 Jan 30 2013 easy_install

note the dash before the 2.7

The easy_install‘s in /usr/bin are for 2.6

$ ls -ltr /usr/bin/easy*
-rwxr-xr-x. 1 root root 331 Nov 11 2010 /usr/bin/easy_install-2.6
-rwxr-xr-x. 1 root root 323 Nov 11 2010 /usr/bin/easy_install

I
would recommend python 2.7 on all local machines

I suspect everyone is already ok?. To check:

[[email protected] etc]# python -V
Python 2.7.3

Instructions for python 2.7 install on windows 7, ubuntu, mac will be on
another page.

Because of centos 6.3 on the cluster machines, we need both 2.6 and 2.7 to
coexist there. hopefully only there.

Centos relies on
python 2.6 for yum

if you install python 2.7 in any way other than the following you will
destroy the system and make yum inoperable

zlib failure message may be from internal python scripts doing uncompression
and they may be referring to python module files, rather than looking at links
directly. Not sure.

I believe only the x86_64 zlib is needed. i.e. you don‘t need 32-bit and
64-bit, but just follow these instructions. They worked on apu.0xdata.loc
(192.168.1.160) on 9/28/2012

to check centos version

[[email protected] etc]# cat /etc/redhat-release
CentOS release 6.3 (Final)

(also okay for centos 6.4)

How
to install Python 2.7.6 on CentOS 6.3 (6.2 and 6.4 okay too, probably
others)

stolen from Daniel Eriksson. Thanks Daniel!

http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/

(modified a little)

CentOS 6.2 ships with Python 2.6.6 and depends on that specific version. Be
careful not to replace it or bad things will happen. If you need access to a
newer version of Python you must compile it yourself and install it side-by-side
with the system version.

Here are the steps necessary to install Python 2.7.6. Execute all the
commands below as root. Either log in as root temporarily or use sudo.

Install development tools

In order to compile Python you must first install the development tools:

yum groupinstall "Development tools"

You also need a few extra libs installed before compiling Python or else you
will run into problems later when trying to install various packages:

yum install zlib-devel
yum install bzip2-devel
yum install openssl-devel
yum install ncurses-devel

Download, compile
and install Python

The --no-check-certificate is optional

cd /opt
wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall

It is important to use altinstall instead of install, otherwise you will end
up with two different versions of Python in the filesystem both named
python.

(Depending on your version of wget, you may need to add the
--no-check-certificate option to the wget command line.)

After running the commands above your newly installed Python 2.7.6
interpreter will be available as /usr/local/bin/python2.7 and the system version
of Python 2.6.6 will be available as /usr/bin/python and /usr/bin/python2.6.

Check with:

[email protected]:/opt/Python-2.7.6 ] ls -ltr /usr/bin/python*

lrwxrwxrwx 1 root root 6 Nov 16 2002 /usr/bin/python2 -> python
-rwxr-xr-x 1 root root 1418 Jul 10 2013 /usr/bin/python2.6-config
-rwxr-xr-x 2 root root 4864 Jul 10 2013 /usr/bin/python2.6
-rwxr-xr-x 2 root root 4864 Jul 10 2013 /usr/bin/python
lrwxrwxrwx 1 root root 16 Oct 24 15:39 /usr/bin/python-config -> python2.6-config

[email protected]:/opt/Python-2.7.6 ] ls -ltr /usr/local/bin/python*
-rwxr-xr-x 1 root root 6214533 Mar 19 22:46 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 1674 Mar 19 22:46 /usr/local/bin/python2.7-config


If things don‘t look right, you might need to create a symbolic link in
/usr/local/bin

cd /usr/local/bin
ls -ltr python*
ln -s /usr/local/bin/python2.7 /usr/local/bin/python

final check:

sudo sh
[email protected]:~ ] which python
/usr/bin/python
[email protected]:/home/0xdiag ] python
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
[email protected]:~ ] exit

sudo - user
[email protected]:~ ] which python
/usr/local/bin/python
[email protected]:~ ] python
Python 2.7.6 (default, Mar 19 2014, 22:45:29)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.


Installing
and configuring distribute (setuptools)


After installing Python 2.7.6 you also need to install distribute
(setuptools) so you can easily install new packages in the right location.

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo /usr/local/bin/python2.7 ez_setup.py
sudo /usr/local/bin/easy_install-2.7 pip

The commands above will generate the script /usr/local/bin/easy_install-2.7.
Use this script to install packages for your new Python version. You should be
able to use "easy_install" if "which easy_install" points to the correct 2.7
versions [email protected]:~ ] which pip /usr/local/bin/pip

$ which easy_install
/usr/local/bin/easy_install

$ ls -ltr /usr/local/bin/easy_install*
-rwxr-xr-x 1 root root 340 Jan 30 2013 /usr/local/bin/easy_install-2.7
-rwxr-xr-x 1 root root 332 Jan 30 2013 /usr/local/bin/easy_install

sudo /usr/local/bin/easy_install-2.7 requests
sudo /usr/local/bin/easy_install-2.7 psutil
sudo /usr/local/bin/easy_install-2.7 paramiko

(for normal user, easy_install should work too, if your PATH gets /usr/local/bin first)


I had to rename pip and easy_install in /user/local/bin and create links. The
existing ones were 2.6 variants i.e.

cd /usr/local/bin
mv pip pip2.6
mv easy_install easy_install-2.6
ln -s pip2.7 pip
ln -s easy_install-2.7 easy_install

result in /usr/local/bin

-rwxr-xr-x 1 root root 6214533 Mar 19 22:46 python2.7
-rwxr-xr-x 1 root root 1674 Mar 19 22:46 python2.7-config
lrwxrwxrwx 1 root root 24 Mar 19 22:51 python -> /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 323 Mar 19 23:18 easy_install-2.6
-rwxr-xr-x 1 root root 331 Mar 19 23:18 easy_install-2.7
-rwxr-xr-x 1 root root 296 Mar 19 23:22 pip2.7
-rwxr-xr-x 1 root root 290 Mar 19 23:22 pip2.6
-rwxr-xr-x 1 root root 292 Mar 19 23:22 pip2
lrwxrwxrwx 1 root root 16 Mar 19 23:29 easy_install -> easy_install-2.7

result in /usr/bin

 ls -ltr /usr/bin/pip
-rwxr-xr-x 1 root root 281 Oct 24 15:38 /usr/bin/pip

ls -ltr /usr/bin/easy_install
-rwxr-xr-x 1 root root 323 Nov 11 2010 /usr/bin/easy_install

[转]Installing python 2.7 on centos 6.3. Follow this sequence
exactly for centos machine only,布布扣,bubuko.com

[转]Installing python 2.7 on centos 6.3. Follow this sequence
exactly for centos machine only

时间: 2024-09-30 13:04:39

[转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only的相关文章

CentOS install Desktop and Remotely access 远程管理Centos桌面 TigerVNC

Centos 安装完毕,但是通过windows 远程管理桌面: 当然我们可以通过secureCRT工具连接命令行,但是我希望通过windows 连接他们的远程桌面: 首先我们的保证 X windows等桌面环境安装成功: yum groupinstall -y "Desktop"   "Desktop Platform"   "Desktop Platform Development" "Fonts" "Genera

CentOS网络设置 couldn't resolve host 'mirrorlist.centos.org问题解决

今天在虚拟机上安装完CentOS6.5之后,首次使用时yum命令安装软件时,出现一堆的"couldn't resolve host 'mirrorlist.centos.org"这个问题. 上网上查了半天,很多都说在/etc/resolv.conf文件末尾添加下边这几段 [plain] view plain copy nameserver 8.8.8.8 nameserver 8.8.4.4 serchdomain localdomain ...布拉布拉布拉...如是云云... 可我试

Installing Python 3.5.2 from source

Here are the procedures we are to follow, Download the source code of an official Python release. Configure the build appropriately for our machine. Compile the software. Test the software to make sure it works properly. Install the software. Configu

error: Microsoft Visual C++ 14.0 is required when installing python package

Binary install it the simple way!I can't believe no one has suggested this already - use the binary-only option for pip. For example, for mysqlclient: pip install --only-binary :all: mysqlclientMany packages don't create a build for every single rele

(二)给Centos配置网络以及使用xshell远程连接Centos

好吧,我对网络协议以及ip配置知识的匮乏,让我在这里折腾了将近一天才搞定.可以说基本上网上遇到的问题我都遇到了.在这里,记下正确的步骤来给Centos配置网络.希望以后少走弯路. 首先我要说明的是,我是在VMware上安装的Centos6.3版本,而且我安装时选择的是没有图形界面的那种方式,也就是只有命令行操作的系统模式.因为想一切从头开始好好学习Linux,所以直接安装了只有命令行模式的桌面.我使用的是桥接方式来给Centos配置网络,下面就讲一下这样配置的步骤吧. 为centos配置网络 (

CentOS部署NetCore - 2. 安装NetCore SDK On CentOS

登录微软官网,进入Install .NET Core SDK on Linux CentOS / Oracle 按照对应的指令,安装SDK Install the .NET SDK Update the products available for installation, install the components required by .NET, then install the .NET SDK. In your command prompt, run the following c

如何在Centos官网下载所需版本的Centos——靠谱的Centos下载教程

很多小伙伴不知道对应版本的Centos怎么下载,最近小编整理了一份Centos详细的下载教程,希望小伙伴们不在为下不到对应版本的Centos而苦恼. 1.进入Centos官网:https://www.centos.org/download/ 不要点击黄颜色背景的下载框,如:DVD ISO,Everything ISO,Minimal ISO,而是点击红色框框内的alternative downloads. 2.下载对应版本的Centos 进入之后,一直将光标往下拉,知道对应的版本出现为止.在这里

如何在Centos官网下载所需版本的Centos

1.进入Centos官网:https://www.centos.org/download/ 不要点击黄颜色背景的下载框,如:DVD ISO,Everything ISO,Minimal ISO,而是点击红色框框内的alternative downloads. 2.下载对应版本的Centos 进入之后,一直将光标往下拉,知道对应的版本出现为止.在这里,小编以Centos6.7为例,进行下载. 3.找到Centos6.7版本 找到Centos6.7版本之后,点击右边的Tree,进入下一个界面. 4.

centos 7搭建vpn(pptpd)服务器 (只限centos 7)

第一步:首先检查ppp是否开启  若使用XEN构架的VPS,此步骤不用执行 终端输入命令:cat /dev/ppp 开启成功的标志:No such file or directory 或者 No such device or address,如果显示No such device or address则表示继续 第二步:安装组件 安装组件之前,先更您yum源,以防错误:http://www.wanghailin.cn/scka/centos7-yum-pero/ 终端依次运行下列命令: a) yu