DNS配置和redhat的python2.6的升级
2017-10-17 19:32
190 查看
[root@testcj tx]# more /etc/resolv.conf
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
这里说的很清楚了
[root@testcj tx]# cd /etc/sysconfig/network-scripts
[root@testcj network-scripts]# ll
total 204
-rw-r--r--. 1 root root 281 Dec 21 2016 ifcfg-eth0
在ifcfg-eth0里配置
DNS1=8.8.8.8
CENTOS 6.X 系列默认安装的 Python 2.6 ,目前开发中主要是使用 Python 2.7 ,这两个版本之间还是有不少差异的,程序在 Python 2.6 下经常会出问题。
比如:
所以,打算安装 Python 2.7 来运行 Flask 应用程序,但 2.6 不能删除,因为系统对它有依赖。
当然,也可以从源码编译安装。
安装成功之后,你可以在
基本就是这些了,网上很多教程都说要做软链接,但我感觉那样做或多或少会对系统有一些未知的影响。这个方法能尽量保持系统的完整性,很多自带 Python 程序其实在头部都指定了
原文:http://digwtx.duapp.com/54.html
参考: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
这里说的很清楚了
[root@testcj tx]# cd /etc/sysconfig/network-scripts
[root@testcj network-scripts]# ll
total 204
-rw-r--r--. 1 root root 281 Dec 21 2016 ifcfg-eth0
在ifcfg-eth0里配置
DNS1=8.8.8.8
CENTOS 6.X 系列默认安装的 Python 2.6 ,目前开发中主要是使用 Python 2.7 ,这两个版本之间还是有不少差异的,程序在 Python 2.6 下经常会出问题。
比如:
re.sub函数 ,2.7 支持
flags参数,而 2.6 却不支持。
所以,打算安装 Python 2.7 来运行 Flask 应用程序,但 2.6 不能删除,因为系统对它有依赖。
1、安装 sqlite-devel
因为 Flask 应用程序可能使用能 Sqlite 数据库,所以这个得装上(之前因为没装这个,导致 Python 无法导入 sqlite3 库。当然,也可以从源码编译安装。
yum install sqlite-devel -y
2、安装 Python 2.7
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz tar xf Python-2.7.8.tgz cd Python-2.7.8 ./configure --prefix=/usr/local make && make install
安装成功之后,你可以在
/usr/local/bin/python2.7找到 Python 2.7。
3、安装 setuptools + pip
这里需要注意,一定要使用 python2.7 来执行相关命令。# First get the setup script for Setuptools: wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py # Then install it for Python 2.7 : python2.7 ez_setup.py # Now install pip using the newly installed setuptools: easy_install-2.7 pip # With pip installed you can now do things like this: pip2.7 install [packagename] pip2.7 install --upgrade [packagename] pip2.7 uninstall [packagename]
4、使用 virtualenv
# Install virtualenv for Python 2.7 and create a sandbox called my27project: pip2.7 install virtualenv virtualenv-2.7 my27project # Check the system Python interpreter version: python --version # This will show Python 2.6.6 # Activate the my27project sandbox and check the version of the default Python interpreter in it: source my27project/bin/activate python --version # This will show Python 2.7.X deactivate
基本就是这些了,网上很多教程都说要做软链接,但我感觉那样做或多或少会对系统有一些未知的影响。这个方法能尽量保持系统的完整性,很多自带 Python 程序其实在头部都指定了
#!/usr/bin/python,所以它们用的其实是 Python 2.6 ,而不是新安装的 Python 2.7 。
原文:http://digwtx.duapp.com/54.html
参考: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
相关文章推荐
- RedHat升级Python2.6到Python3.4.3版本
- 03-redhat-6.5升级python2.6到python2.7&安装psycopg2&连接postgresql-9.6.1(201-02-07)
- redhat 默认python2.6 升级到2.7
- Exchange2010升级到2016——配置Exchange2016连接器、外部DNS设置
- python 2.6 升级到 2.7
- python版本是2.6升级到2.7.3
- RedHat Linux AS 5.3 下DNS的配置步骤----为学习Oracle网络管理埋下伏笔
- centos6默认python2.6升级2.7 卸载python2.6升级2.7
- CentOS升级Python 2.6到2.7
- [转] Centos 6.4 python 2.6 升级到 2.7
- Centos 6.4 python 2.6 升级到 2.7
- Centos 6.4 python 2.6 升级到 2.7
- centos 6.8 下python2.6 升级python2.7,安装pip工具
- Centos升级python到2.6
- python2.6升级2.7的方法及升级后的故障处理
- centos 64 python2.6升级到2.7后中文输入法问题
- Centos6.7 python2.6升级到python2.7
- redhat6 下DNS配置详解
- RedHat 6.3 配置163 yum 升级源
- Centos 6.4 python 2.6 升级到 2.7