centos6安装python3

到官网找到最新版本源码下载地址

https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

[[email protected] Downloads]# wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
[[email protected] Downloads]# tar zxvf Python-3.5.1.tgz
cd Python-3.5.1
 ./configure --prefix=/usr/local/python3
make
make install

Installing collected packages: setuptools, pip
Successfully installed pip-7.1.2 setuptools-18.2

修改旧的python链接

mv /usr/bin/python /usr/bin/python_old

建立链接

ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

运行python

[[email protected] Python-3.5.1]# python
Python 3.5.1 (default, Dec 25 2015, 21:48:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

由于centos的yum依赖python2.6,这样一来yum无法使用

[[email protected] ~]# yum
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

[[email protected]-zabbix ~]# ll /usr/bin | grep python
-rwxr-xr-x.   1 root root       11016 1月  24 2013 abrt-action-analyze-python
lrwxrwxrwx    1 root root          24 12月 25 21:53 python -> /opt/python3/bin/python3
lrwxrwxrwx.   1 root root           6 11月 14 07:12 python2 -> python
-rwxr-xr-x.   2 root root        9032 10月 13 2012 python2.6
-rwxr-xr-x.   1 root root        1418 10月 13 2012 python2.6-config
lrwxrwxrwx.   1 root root          16 11月 14 07:12 python-config -> python2.6-config
-rwxr-xr-x.   2 root root        9032 10月 13 2012 python_old

修改yum的配置文件将#!/usr/bin/python改为#!/usr/bin/python2.6

vim /usr/bin/yum
[[email protected]-zabbix ~]# yum
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
You need to give some command
Usage: yum [options] COMMAND

List of Commands:

恢复可用

时间: 2024-12-28 20:36:04

centos6安装python3的相关文章

centos6安装python3.4和pip3

在安装了epel源的情况下,直接yum就可以安装python3.4 yum install python34 -ypython3 --version 没有自带pip3,从官网安装 wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py python3 get-pip.pypip3 -V 写个简单的代码 #!/usr/bin/python3 # -*- coding: UTF-8 -*- import sys print(s

centos6 安装python3.5后pip无法使用的处理

现象:安装pip后发现命令无法识别command not found 原因:which查看找到不到执行路径   find搜索发现安装后存放在/usr/local/python3.5/bin下,于是判断是因为没有注册路径的问题 解决:参考地址为https://lempstacker.com/tw/Installing-Python-3-5-on-CentOS-7/ http://blog.csdn.net/apn172/article/details/8868968 1.导出头文件: /usr/l

centos6安装python3.6.4

安装Python依赖包: [[email protected] src]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make 下载Python源码包: [[email protected] src]# wget ttp://mirrors.sohu.com/python/3.6.4/Python-3.6.4.tgz 编译.安装:

Centos6 安装python3.6

1.安装依赖包yum install bzip2-devel db4-devel expat-devel gcc gdbm-devel libffi-devel libpcap-devel ncurses-devel openssl-devel patch python-devel readline-devel sqlite-devel tk-devel xz-devel zlib-devel -y 2.下载python3.6安装包:wget --no-check-certificate htt

centos6.5下安装python3安装、python3虚拟环境创建venv

原因:在安装完centos6.5后,通过命令行键入python时,默认为python2.6.6版本,系统并没有安装python3版本.又想学习python3,因此需要在centos6.5下安装python3版本. <python3安装> 1.下载python3的安装包: (1)如果能够联网,则直接: [[email protected] 3pyex]# wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz 其中,我这里安装的

centos6.8安装python3.7.3报错Can&#39;t connect to HTTPS URL because the SSL module is not available问题解决

环境:CentOS release 6.8 (Final) # 直接编译python3.7在使用pip3安装依赖的时候报错: Can't connect to HTTPS URL because the SSL module is not available. 解决方法: 1.编译安装OpenSSL 1.0.2j版本并重新配置环境变量 下载OpenSSL源码包: wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz 解压缩,编译安装:

centos6/7 python3及yum安装教程

适用于Centos6/7 1.配置好epel源和ius源 Centos 6 yum install https://centos6.iuscommunity.org/ius-release.rpm -ywget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo Centos 7 yum install https://centos7.iuscommunity.org/ius-release.rpm -

centos6.5安装python3.5 和 ipython

云盘包地址 :http://pan.baidu.com/s/1bpsgXUf环境 centos 6.5 最小化安装版,装好开发环境包. ①安装python3.5 yum install readline-devel -y  #不安装会导致python解释器里面没法用删除键等tar -zxvf Python-3.5.1.tgzcd Python-3.5.1./configure –prefix=/usr/local –enable-sharedmake && make installln -

CentOS6.8安装Python3.6.3

1.linux下安装python3 准备编译环境(环境如果不对的话,可能遇到各种问题,比如wget无法下载https链接的文件) yum install zlib-devel bzip2-devel openssl-devel ncurses-devel -y 2.下载 Python3.6代码包 wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz 在安装包中有一个README的文件,里面有写如何安装,解压并安装 tar