zoukankan      html  css  js  c++  java
  • 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.
    >>> 
  • 相关阅读:
    sgu114Telecasting station
    UVA11748 Rigging Elections (dfs)
    UVA11080Place the Guards (二分图染色)
    修复损坏的COM+目录
    iis增加对flv的支持
    CRM开发中的小技巧
    CRM中代理商,招商专员,招商经理,公司内部员工权限描述
    使用js为DataGrid设定行
    文档和在线视频开发
    网站数据采集
  • 原文地址:https://www.cnblogs.com/chenjw-note/p/11435001.html
Copyright © 2011-2022 走看看