zoukankan      html  css  js  c++  java
  • 【Python 开发】第二篇 :Python安装

    一、python3.x安装

    1)由于centos7原本就安装了Python2,而且这个Python2不能被删除,因为有很多系统命令,比如yum都要用到。

    官网:https://www.python.org/

    [root@host130 ~]# python
    Python 2.7.5 (default, Nov  6 2016, 00:28:07) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    [root@host130 ~]# which python
    /usr/bin/python
    [root@host130 ~]# 
    

    二、源码安装python3.7  

    2)通过源码安装python3.x,我选择是安装python3.7
    2.1 下载依赖包
    [root@host130 ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel2.2 
    [root@host130 src]# pwd 
    /usr/local/src
    下载不同版本的Python3,我下载的是Python3.7
    [root@host130 src]# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0rc1.tgz 
    [root@host130 src]# tar -zxvf Python-3.7.0rc1.tgz
    [root@host130 src]# cd Python
    -3.7.0rc1/
    [root@host130 Python
    -3.7.0rc1]# ls
    aclocal.m4 configure.ac
    install-sh
    Mac Objects Programs setup.py config.guess Doc Lib Makefile.pre.in Parser pyconfig.h.in
    Tools config.sub Grammar LICENSE Misc PC Python configure Include m4 Modules PCbuild README.rst
    [root@host130 Python
    -3.7.0rc1]# ./config
    config.guess config.sub configure
    [root@host130 Python
    -3.7.0rc1]# ./configure --prefix=/usr/local/python3
    [root@host130 Python
    -3.7.0rc1]# make && make install
    [root@host130 Python-3.7.0rc1]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    [root@host130 Python-3.7.0rc1]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
    [root@host130 Python-3.7.0rc1]# python3
    Python 3.7.0rc1 (default, Sep 18 2018, 18:22:18) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit
    Use exit() or Ctrl-D (i.e. EOF) to exit
    >>> 
    参考博客:https://www.cnblogs.com/dangkai/p/9394363.html

    三、编译时报错处理

    o module named '_ctypes'    参考博客:https://blog.csdn.net/qq_36416904/article/details/79316972

    的解决办法: 原因:3.7版本需要一个新的包libffi-devel,安装此包之后再次进行编译安装即可。 [root@host130 Python-3.7.0rc1]# yum -y install libffi-devel [root@host130 Python-3.7.0rc1]# make && make install 安装成功: [root@host130 Python-3.7.0rc1]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3 [root@host130 Python-3.7.0rc1]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 [root@host130 Python-3.7.0rc1]# python3 Python 3.7.0rc1 (default, Sep 18 2018, 18:22:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit Use exit() or Ctrl-D (i.e. EOF) to exit >>>
  • 相关阅读:
    偶对学习C#以及理解.Net平台的一些看法(二,Junior Bibliography)
    聊聊编程那些破事0.Prehistory
    偶对学习C#以及理解.Net平台的一些看法(一,Prerequisites)
    [转帖]c#.net常用函数列表
    一个编程小题目引发的思考(上)
    geoTools学习笔记001(简介)
    ArcGIS Server 10安装配置(JAVA)
    ARCGIS中label(标注)和Annotation(注记
    JSTL入门开发包详解
    基于C/S的网盘设计(JAVA) 网盘源码实现部分功能
  • 原文地址:https://www.cnblogs.com/yangleitao/p/9670782.html
Copyright © 2011-2022 走看看