赞
踩
随着python语言的受欢迎度,Python现可以应用于多种操作系统,例如Linux、Windows、Mac OS X等。所以我们今天就在Linux和Windows下如何部署Python开发环境,可能小伙伴会问为什么没有Mac OS 下的讲解那,我会一脸懵逼的告诉你,南海是中国的。。。
Python环境现已基本成为了Linux系统的标配,系统安装时便安装的Python,Redhat6与Centos6等系统默认安装的为Python2.6的版本。
虽然现在python3版本已经更新到Python3.5.2,但是现生产环境下Python2.7版本还是用的比较多了,那么我今天来用源码安装Python2.7。
[root@localhost src]# wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
[root@localhost Python-2.7.12]# yum groupinstall -y "Development tools" # Develoment tools 是Redhat系统里面的一个编译环境的组
[root@localhost src]# tar zxvf Python-2.7.12.tgz -C ./
[root@localhost src]# cd Python-2.7.12
[root@localhost Python-2.7.12]# ./configure --prefix=/usr/bin/python27 # prefix 指定安装路径
[root@localhost Python-2.7.12]# make && make install
[root@localhost ~]# /usr/bin/python27/bin/python
Python 2.7.12 (default, Aug 4 2016, 09:56:11)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@localhost ~]# mv /usr/bin/python /usr/bin/python2.6 #此动作为将之前的python2.6版本进行重命名
[root@localhost ~]# ln -s /usr/bin/python27/bin/python2.7 /usr/bin/python # 将python2.7链接为/usr/bin/python
[root@localhost ~]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.12 (default, Aug 4 2016, 09:56:11)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
对于Windows系统我们使用最新版本Python3.5.2来作为安装实例。
到此位置基本上我们的python环境算是基本安装完成,后边我们就可以进行正式的接触python,以及讲解python的各种用法,灰常有趣哦!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。