1、CentOS7 安装Python 的依赖包

# yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc-c++

## ubuntu 需要安装
第一次编译安装之后, 有可能会发现输入 python3 命令后, 方向键失效
原因是 readline 库没有安装。
解决方式, 安装 readline 库 # sudo apt-get install libreadline-dev 安装之后,再将 python 重新编译安装一次。

2、下载Python3.5的源码包并编译

2.1. 编译安装 python3.5.3

# wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
# tar -xf Python-3.5.3.tgz
# cd Python-3.5.3
# mkdir /usr/python3.5
# ./configure --prefix=/usr/python3.5
# make && make install

2.2. 设置命令执行路径

# ln -s /usr/python3.5/bin/python3 /usr/bin/python3
# echo 'export PATH=$PATH:/usr/python3.5/bin/' >> /etc/profile
# source /etc/profile

2.3. 如果是 ubuntu 的话就执行

# ln -s /usr/python3.5/bin/python3 /usr/bin/python3

3、 指定  pip3 命令

# ln -s /usr/python3.5/bin/pip3 /usr/local/sbin/

==================   可以不做   ============================

4、在运行Python之前需要配置库:

# echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
# ldconfig

5、查看版本:

# python3 -V

6、配置默认 豆瓣源

# mkdir ~/.pip
# vim ~/.pip/pip.conf [global]
index-url = https://pypi.douban.com/simple
download_cache = ~/.cache/pip [install]
use-mirrors = true
mirrors = http://pypi.douban.com/

7. 可选项: 安装 virtualenv 服务软件 (推荐装上)

7.1. 安装 virtualenv

# pip3 install virtualenv

7.2. 利用 virtualenv 创建 虚拟 python3 env 环境

# 创建 virtualenv , 名字为 /root/env_test
# virtualenv /root/env_test

7.3. 启动 env 环境呢与退出环境

7.3.1. 启动
# source /root/env_test/bin/activate 
7.3.2. 退出
# deactivate
7.3.3. 相关博客:
https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432712108300322c61f256c74803b43bfd65c6f8d0d0000

CentOS7 安装python 3.5 及 pip安装的更多相关文章

  1. python安装pip和使用pip安装Python库类比如pip安装beautifulsoup4

    初学Python时,看到很多不懂得东西,比如 pip, 是python 包管理工具,pip是easy_install的取代. Distribute是对标准库disutils模块的增强,我们知道disu ...

  2. 转: CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法

    from: http://www.linuxde.net/2014/05/15576.html CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法 2014/05/ ...

  3. CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法

    CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法如下: 截至包子写本文的时候,pip最新为 1.5.5 wget --no-check-certificate h ...

  4. ubuntu 安装python,easy_install和pip

    ubuntu12.04默认安装的python为 ms@ubuntums:~$ pythonPython 2.7.3 (default, Aug 1 2012, 05:16:07) 我需要用python ...

  5. python︱模块加载(pip安装)以及pycharm安装与报错解决方式

    每每以为攀得众山小,可.每每又切实来到起点,大牛们,缓缓脚步来俺笔记葩分享一下吧,please~ --------------------------- 准备放下R开始学python,真是痛苦,因为找 ...

  6. 【Python使用】使用pip安装卸载Python包(含离线安装Python包)未完成???

    pip 是 Python 包管理工具,该工具提供了对Python包的查找.下载.安装.卸载的功能.Python 2.7.9 + 或 Python 3.4+ 以上版本都自带 pip 工具. pip使用( ...

  7. Linux 下 安装Python第三方模块工具箱pip,以及用pip安装的方法

    下载文件 wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate 执行安装 python get-pip.py 可以做一个软连 ...

  8. python包管理之Pip安装及使用-1

    Python有两个著名的包管理工具easy_install.py和pip.在Python2.7的安装包中,easy_install.py是默认安装的,而pip需要我们手动安装. pip可以运行在Uni ...

  9. python包管理之Pip安装及使用

    Python有两个著名的包管理工具easy_install.py和pip.在Python2.7的安装包中,easy_install.py是默认安装的,而pip需要我们手动安装. pip可以运行在Uni ...

随机推荐

  1. remove_if 的效率测试

    #include <iostream> #include <functional> #include <vector> #include <algorithm ...

  2. Python数据分析与展示第2周学习笔记(北理工 嵩天)

    单元4:Matplotlib库入门 matplotlib.pyplot是绘制各类可视化图形的命令子库,相当于快捷方式 import matplotlib.pyplot as plt # -*- cod ...

  3. 第一章:基于面向对象的UML

    1.1什么是面向对象 面向对象程序设计(Object-Oriented Programming,OOP)立足于创建软件代码的重复使用,具有更好地模拟现实世界的能力,这使它被公认为是自上而下编程的最佳选 ...

  4. learning Perl:91行有啥用? 88 print "\n----------------------------------_matching_multiple-line_text--------------------------\n"; 91 my $lines = join '', <FILE>;

    89 open FILE, "< file_4_ex_ch7.txt"     90     or die "cannot open file: $!"; ...

  5. Metasploit详解

    title date tags layout Metasploit 详解 2018-09-25 Metasploit post 一.名词解释 exploit 测试者利用它来攻击一个系统,程序,或服务, ...

  6. [LC] 285. Inorder Successor in BST

    Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Th ...

  7. kaggle下载不了比赛数据?

    先看这个 kaggle数据集下载 -------------------------------- 有时发现下载不了kaggle数据 关于kaggle没有办法下载数据集dataset问题 安装kagg ...

  8. made his acquaintance|adequate|advisable|announce|contrived to|made up|toss|considering that

    PHRASE 与(某人)初次相识;结识(某人)When you make someone's acquaintance, you meet them for the first time and ge ...

  9. 【转】mac os x配置adb命令的方法,苹果电脑设置adb命令的方法

    http://www.myexception.cn/operating-system/1636963.html 步骤如下: 1. 启动终端Terminal (如果当前用户文件夹下已有.bash_pro ...

  10. leetcode第30题:括号生成

    这是目前遇到最难的题,刚开始的思路是:匹配words中元素是否在s中,若在找所在元素的后words长度位的字符串,判断words其他元素是否都在s中. 看似这个思路可行,实际上存在的问题: 1.wor ...