前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Centos6 安装python3 pip3 ipython3

Centos6 安装python3 pip3 ipython3

作者头像
Devops海洋的渔夫
发布2019-06-26 13:57:38
3.9K0
发布2019-06-26 13:57:38
举报
文章被收录于专栏:Devops专栏Devops专栏

访问官网查看python 3.6.x 系列有什么安装包

因为是Centos6,前面安装3.7.x系列在SSL这块有些问题,考虑使用3.6.x系列看看。

访问官网下载地址:https://www.python.org/downloads/source/

安装系统依赖

代码语言:javascript
复制
[root@centos6 Python-3.6.8]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel -y

下载python3.6.x的安装包

代码语言:javascript
复制
[root@centos6 opt]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz

安装过程

代码语言:javascript
复制
[root@centos6 opt]# tar -zxvf Python-3.6.8.tgz 
[root@centos6 Python-3.6.8]# ./configure --prefix=/usr/local/python3
[root@centos6 Python-3.6.8]# make && make install

设置环境

安装完毕之后,文件会在/usr/local/python3/bin/路径下。

代码语言:javascript
复制
[root@centos6 Python-3.6.8]# ls /usr/local/python3/bin/
2to3      easy_install-3.6  idle3.6  pip3.6  pydoc3.6  python3.6         python3.6m         python3-config  pyvenv-3.6
2to3-3.6  idle3             pip3     pydoc3  python3   python3.6-config  python3.6m-config  pyvenv
[root@centos6 Python-3.6.8]# 
[root@centos6 bin]# ./python3.6
Python 3.6.8 (default, Apr 23 2019, 14:53:03) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@centos6 bin]# 
[root@centos6 bin]# ./pip3 search redis
redis (3.2.1)                     - Python client for Redis key-value store
redis-completion (0.5.0)          - autocomplete with redis

设置软连接 ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

设置之后,就可以全局使用了,如下:

代码语言:javascript
复制
[root@centos6 bin]# ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6
[root@centos6 bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
[root@centos6 bin]# 
[root@centos6 bin]# cd ~
[root@centos6 ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  gitbook  install.log  install.log.syslog  Music  netperf-2.6.0-2.gf.el6.x86_64.rpm  Pictures  Public  Templates  tmp  Videos
[root@centos6 ~]# python3.6
Python 3.6.8 (default, Apr 23 2019, 14:53:03) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
[root@centos6 ~]# pip3 search redis
redis (3.2.1)                     - Python client for Redis key-value store
redis-completion (0.5.0)          - autocomplete with redis
kinto-redis (2.0.0)               - Kinto Redis

升级pip3到最新版本

pip3 install --upgrade pip

代码语言:javascript
复制
[root@centos6 ~]# pip3 install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 122kB/s 
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3
[root@centos6 ~]# 

安装ipython3

pip3 install ipython

安装完毕后,可以从/usr/local/python3/bin目录下找到ipython的二进制可执行文件。

代码语言:javascript
复制
[root@centos6 ~]# cd /usr/local/python3/bin
[root@centos6 bin]# ls
2to3      easy_install-3.6  idle3.6  iptest3  ipython3  pip3    pydoc3    pygmentize  python3.6         python3.6m         python3-config  pyvenv-3.6
2to3-3.6  idle3             iptest   ipython  pip       pip3.6  pydoc3.6  python3     python3.6-config  python3.6m-config  pyvenv
[root@centos6 bin]# ./ipython
/usr/local/python3/lib/python3.6/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved
  warn("IPython History requires SQLite, your history will not be saved")
Python 3.6.8 (default, Apr 23 2019, 14:53:03) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:    

配置ipython3的软链接

ln -s /usr/local/python3/bin/ipython /usr/bin/ipython3

代码语言:javascript
复制
[root@centos6 bin]# ln -s /usr/local/python3/bin/ipython /usr/bin/ipython3
[root@centos6 bin]# 
[root@centos6 bin]# cd ~
[root@centos6 ~]# 
[root@centos6 ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  gitbook  install.log  install.log.syslog  Music  netperf-2.6.0-2.gf.el6.x86_64.rpm  Pictures  Public  Templates  tmp  Videos
[root@centos6 ~]# 
[root@centos6 ~]# ipython3
/usr/local/python3/lib/python3.6/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved
  warn("IPython History requires SQLite, your history will not be saved")
Python 3.6.8 (default, Apr 23 2019, 14:53:03) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:      

Centos6 对于python3的兼容性

经过了Centos6对于python 3.7.x 和 python 3.6.x 的安装对比,还是使用python 3.6.x的兼容性最好。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019.06.25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 访问官网查看python 3.6.x 系列有什么安装包
  • 安装系统依赖
  • 下载python3.6.x的安装包
  • 安装过程
  • 设置环境
  • 升级pip3到最新版本
  • 安装ipython3
  • 配置ipython3的软链接
  • Centos6 对于python3的兼容性
相关产品与服务
云数据库 Redis
腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档