(1) centos6安裝python2.7
sudo yum -y install python-devel openssl openssl-devel gcc sqlite-devel
wget
tar zxvf python-2.7.6.tgz
cd python-2.7.6
./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared
sudo make
sudo make install altinstall
sudo ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib
sudo ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib
sudo ln -s /usr/local/python2.7/bin/python2.7 /usr/local/bin
sudo /sbin/ldconfig -v
# ok
python2.7 -v
安裝pip.
wget --no-check-certificate
tar xf distribute-0.6.49.tar.gz
cd distribute-0.6.49
python2.7 setup.py install
sudo /usr/local/python2.7/bin/easy_install pip
#ok
/usr/local/python2.7/bin/pip install ***安裝完之後,我們執行python命令,輸入exit() 命令退出python程式
[root@localhost ~]# python
python 2.6.6 (r266:84292, aug 18 2016,15:13:37)
[gcc 4.4.7 20120313 (red hat 4.4.7-17)]on linux2
>>> exit()
執行which python命令,你會發現預設的python是在/usr/local/bin/python
目錄下,實際上我們新安裝的python也在這個目錄下
[root@localhost ~]# which python
/usr/bin/python
[root@localhost ~]# python
python 2.6.6 (r266:84292, aug 18 2016,15:13:37)
[gcc 4.4.7 20120313 (red hat 4.4.7-17)]on linux2
>>> print"hello,world"
hello,world
>>> print "python2.7"
python2.7
>>> 1+2+3
6>>> exit()
開始練習python指令碼
[root@localhost ~]# cd /tmp
[root@localhost tmp]# vim hello.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
name = raw_input('please input yourname:')
print "hello,world!","ilove meinv",name
print"1+2+3+4+5+6+7+8+9+10=",1+2+3+4+5+6+7+8+9+10
print 'i\'m learning\"python\"!'
print '''line1
line2
line3'''
print '中文測試正常'
[root@localhost tmp]# chmod +x hello.py
[root@localhost tmp]# python hello.py
please input your name:tangtang
hello,world! i love meinv tangtang
1+2+3+4+5+6+7+8+9+10= 55
i'm learning "python"!
line1
line2
line3
中文測試正常
(2) centos6安裝python3.5
wget
tar xf python-3.5.0.tgz
cd python-3.5.0
./configure --prefix=/usr/local--enable-shared
make
make install
ln –s /usr/local/bin/python3 /usr/bin/python3
在執行python之前需要配置庫:
echo /usr/local/lib >>/etc/ld.so.conf.d/local.conf
ldconfig
執行演示:
python3 --version
python 3.5.0
Python3 7安裝部署
教你如何在 centos 7 下編譯安裝 python 3.7 與 python 2.7.5 共存。環境 centos 7.6 x64 一 安裝python 3.7 wget 如果沒有wget命令,可以使用命令安裝 yum y install wget 安裝依賴包,避免安裝過程 現的 zipimpo...
安裝部署redis redis 安裝部署
wget redis 3.2.12.tar.gz 第二步 上傳軟體並解壓 解壓tar xzf redis 3.2.12.tar.gz改名稱 mv redis 3.2.12 redis第三步 安裝依賴軟體 yum y install gcc automake autoconf libtool make...
mysql的安裝部署
shell groupadd mysql shell useradd g mysql mysql shell cd usr local shell gunzip path to mysql version os.tar.gz tar xvf shell ln s mysql version os m...