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 >>>
  • 相关阅读:
    select选择框去掉默认的下拉箭头
    网站怎么添加ico小图标
    js实现逐字打印效果,文本逐字显示
    jQuery实现消息列表循环垂直向上滚动
    滤镜图片变黑白+图片模糊
    多选下拉框(select 下拉多选)
    JavaScript 数组相关基础方法
    h5+ IOS App中判断本地文件是否存在 plus.io.resolveLocalFileSystemURL()
    h5+ IOS App中取消视频默认全屏播放
    C# 多线程与队列操作小练刀
  • 原文地址:https://www.cnblogs.com/yangleitao/p/9670782.html
Copyright © 2011-2022 走看看