Up in the Air!
在云端
Home
Categories
Archives
Tags
About
Home
Centos使用Yum安装python3.6.5
Centos使用Yum安装python3.6.5
取消
Centos使用Yum安装python3.6.5
由
aoeII
发布于 2018-06-04
·
最后更新:2018-08-27
925
本文介绍在Centos 6和7上通过yum安装新版的python 3.6.5 部分内容来自网络,欢迎转载,转载请注明出处:https://aoeii.com/posts/how_to_yum_install_python-3.6.5_on_centos_6_and_7 ---------- 众所周知,centos自带的python是python2,不自带python3,以前都是靠编译完的安装包安装python3的,不用yum主要是epel源里的python3版本太低,又找不到其他好的源,这回终于找到了IUS源,IUS(Inline with Upstream Stable)是一个社区项目,它旨在为Linux企业发行版提供可选软件的最新版RPM软件包。 IUS软件替换CentOS基本源中的软件使用的是安全替换的方式:即当CentOS系统中安装了相应的软件后,再使用IUS源安装相应的软件,IUS软件不会直接更新升级系统自带的软件源,而是提示一个冲突,如果要安装IUS软件,需要先卸载CentOS系统中自带的相应的软件。 #安装步骤 ## 安装EPEL软件源 IUS依赖于EPEL,直接yum安装即可 yum -y install epel-release ## 安装IUS软件源 请根据您的系统选择rpm包: https://rhel6.iuscommunity.org/ius-release.rpm https://rhel7.iuscommunity.org/ius-release.rpm https://centos6.iuscommunity.org/ius-release.rpm https://centos7.iuscommunity.org/ius-release.rpm 如果系统是CentOS6.x,那么选择CentOS6的源并安装 rpm -ivh https://centos6.iuscommunity.org/ius-release.rpm 如果系统是CentOS7.x,那么选择CentOS7的源并安装 rpm -ivh https://centos7.iuscommunity.org/ius-release.rpm 安装完成后进入下一步 ## 安装python3.6.5 直接安装即可 yum -y install python36u python36u-pip python36u-devel 或者 yum install python36u python36u-pip python36u-devel --disablerepo "*" --enablerepo "ius" > warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY > Retrieving key from file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY > Importing GPG key 0x9CD4953F: > Userid : IUS Community Project <coredev@iuscommunity.org> > Package: ius-release-1.0-15.ius.centos6.noarch (installed) > From : /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY > Is this ok [y/N]: y 安装完成后,检查是否安装成功 python3.6 > Python 3.6.5 (default, Apr 10 2018, 17:08:37) > [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> pip3.6 -V > pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6) ## 建立连接 用的朋友可能会感觉python3.6这个命令太长,那么我们可以做连接,更加贴近习惯 ln /usr/bin/python3.6 /usr/bin/python3 ln /usr/bin/pip3.6 /usr/bin/pip3 然后就可以使用pip3,python3命令 python3 > Python 3.6.5 (default, Apr 10 2018, 17:08:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux Type "help", "copyright", "credits" or "license" for more information. > >>> exit(); pip3 -V > pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6) 如果觉得pip3还是麻烦,同时也没有为系统自带的python 2.7安装pip,可以将pip3.6命令直接链接到pip ln /usr/bin/pip3.6 /usr/bin/pip ## 脚本使用python3 在 Python 脚本前加入注释行 #! /usr/bin/env python3 ## 升级pip9到10 pip install --upgrade pip > Collecting pip Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 975kB/s Installing collected packages: pip Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 Successfully installed pip-10.0.1 #总结 ## 一键安装 Centos 6 yum -y install epel-release rpm -ivh https://centos6.iuscommunity.org/ius-release.rpm yum -y install python36u python36u-pip python36u-devel Centos 7 yum -y install epel-release rpm -ivh https://centos7.iuscommunity.org/ius-release.rpm yum -y install python36u python36u-pip python36u-devel ## 建立连接 ln /usr/bin/python3.6 /usr/bin/python3 ln /usr/bin/pip3.6 /usr/bin/pip3 # 可选 ln /usr/bin/pip3.6 /usr/bin/pip # Python-常用包 1. mysql包 # python 2.x pip install mysql-python # python 3.x pip install pymysql # python 3.x option 2 pip install mysqlclient # for MySQL、Postgresql、Oracle、MS SQLServer、SQLite pip install sqlalchemy 例如:为python3安装mysql包 pip3 install pymysql > Collecting pymysql Downloading https://files.pythonhosted.org/packages/32/e8/222d9e1c7821f935d6dba8d4c60b9985124149b35a9f93a84f0b98afc219/PyMySQL-0.8.1-py2.py3-none-any.whl (81kB) 100% |████████████████████████████████| 81kB 4.4MB/s Installing collected packages: pymysql Successfully installed pymysql-0.8.1 2. numpy pip install numpy 3. pandas pip install pandas 4. redis pip install redis 5. scipy pip install scipy 6. tushare pip install msgpack pip install pandas pip install lxml pip install requests pip install bs4 pip install tushare 7. ipython pip install ipython 8. matplotlib # python 3.x pip install matplotlib # python 2.x pip install functools32 yum -y install gcc gcc-c++ kernel-devel python-devel yum -y install libxslt-devel libffi-devel openssl-devel #可选 pip install freetype-py #可选 pip install pypng #可选 pip install subprocess32 pip install matplotlib 9. itchat # wechat bot pip install itchat 10. pymongo # mogodb pip install pymongo # 常用命令 yum install python-devel # 安装devel yum install python-pip # 安装pip pip install --upgrade pip # 升级pip python -m pip install --upgrade --force pip # 强制升级pip python -m pip uninstall pip # 卸载pip pip install setuptools #安装setuptools pip install --upgrade setuptools pip install ez_setup easy_install -U setuptools #升级setuptools pip install virtualenv #安装虚拟环境 pip list #查看已安装包列表
blog
python
python
centos
linux
该博客文章由作者通过
CC BY 4.0
进行授权。
分享
最近更新
ESXi 6.7 离线升级 7.0U3
N5105 软路由安装 ESXi 7 直通核显给 Debian / Ubuntu 虚拟机通过 Docker 实现 jellyfin 硬件转码视频文件(硬解/编码)
Leanote 支持 emoji、chart.js 以及 mermaid
手把手教你自建开源免费私有云盘服务nextcloud 14
在Centos 6和7上安装设置MySQL / MariaDB 5.5或以上的版本
热门标签
linux
centos
python
ESXi
windows
leanote
mysql
font
Docker
phpmyadmin
文章目录
更改 Windows 命令行字体
systemctl 中文手册