• python版本升级流程,升级2.7跟3.x版本流程一样


    前言:

      目前python2.6版本很多库已经不支持,在安装库的时候总会遇到很多装不上的事故,特别烦恼,所以以后不纠结,直接升级python版本后再使用,避免多次采坑;当然,未来趋势还是python3.xxx版本,允许条件下,新环境还是用python3.0版本以上比较稳妥。

    1.其中一个错误,运行django项目时报错:缺少sqlite3,下面编译需要先安装sqlite3

    django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'

    2.安装Python依赖包:

    yum install libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite sqlite-devel readline-devel tk-devel gcc make python-devel libxslt-devel gpgme-devel -y

    3.编译安装python

    ./configure --prefix=/usr/local/python2.7
    make
    make install

    4.安装setuptools

    /usr/local/python2.7/bin/python setup.py install

    5.安装pip

    /usr/local/python2.7/bin/python setup.py install

    6.配置环境变量【可以选择不配置】

    vim /etc/profile
    
    ulimit -n 65535
    PATH=/usr/local/python2.7/bin:$PATH
    PATH=/usr/local/python2.7/lib/python2.7/site-packages/django/bin:$PATH
    
    source /etc/profile

    7.检查版本

    pip -V
    
    pip 19.1.1 from /usr/local/python2.7/lib/python2.7/site-packages/pip-19.1.1-py2.7.egg/pip (python 2.7)
    
    
    python
    
    Python 2.7.16 (default, Aug 30 2019, 14:50:21) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
  • 相关阅读:
    Using Subversion and ViewCVS on Solaris 10
    Solaris开放源代码了!
    小笨霖英语笔记本(0)
    How to start CDE/JDS with xinit command
    英译汉练习:Solaris 10进入Linux领地
    UNIX/LINUX 平台可执行文件格式分析
    小笨霖英语笔记本(2)
    小笨霖英语笔记本(3)
    小笨霖英语笔记本(1)
    魔鬼城雅丹地貌
  • 原文地址:https://www.cnblogs.com/chenjw-note/p/11435001.html
Copyright © 2020-2023  润新知