zoukankan      html  css  js  c++  java
  • 无网情况下linux安装django

    创建虚拟环境
    ~/project/hanqin/django> virtualenv monitor2
    ~/project/hanqin/django/monitor2> cd bin
    ~/project/hanqin/django/monitor2/bin> source activate

    上传Django-1.11.11到以下文件夹
    ~/project/hanqin/django/monitor2/tmp
    ~/project/hanqin/django/monitor2/tmp> cd Django-1.11.11/
    ~/project/hanqin/django/monitor2/tmp/Django-1.11.11> python3 setup.py install

    安装时候最后面因为没网报错,

    Processing dependencies for Django==1.11.11
    Searching for pytz
    Reading https://pypi.python.org/simple/pytz/
    Download error on https://pypi.python.org/simple/pytz/: unknown url type: https -- Some packages may not be found!
    Couldn't find index page for 'pytz' (maybe misspelled?)
    Scanning index of all packages (this may take a while)
    Reading https://pypi.python.org/simple/
    Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
    No local packages or working download links found for pytz
    error: Could not find suitable distribution for Requirement.parse('pytz')

    去官网下载对应版本的tz,tz是timezone时区的意思,我用的python3.6下的是标红版本

    https://pypi.python.org/pypi/pytz/#downloads

    ~/project/hanqin/django/monitor2/tmp> tar -zxvf pytz-2018.3.tar.gz 

    ~/project/hanqin/django/monitor2/tmp> cd pytz-2018.3/

    ~/project/hanqin/django/monitor2/tmp/pytz-2018.3> python3 setup.py  install

    ~/project/hanqin/django/monitor2/tmp/pytz-2018.3> cd /home/insp_ap/project/hanqin/django/monitor2/lib/python3.6/site-packages/

    ~/project/hanqin/django/monitor2/lib/python3.6/site-packages> ls -lrt
    total 511
    drwxr-xr-x 2 insp_ap users 344 Apr 7 10:42 setuptools-28.8.0.dist-info
    drwxr-xr-x 5 insp_ap users 1032 Apr 7 10:42 setuptools
    drwxr-xr-x 5 insp_ap users 160 Apr 7 10:42 pkg_resources
    -rw-r--r-- 1 insp_ap users 126 Apr 7 10:42 easy_install.py
    drwxr-xr-x 2 insp_ap users 96 Apr 7 10:42 __pycache__
    drwxr-xr-x 2 insp_ap users 312 Apr 7 10:42 wheel-0.29.0.dist-info
    drwxr-xr-x 6 insp_ap users 592 Apr 7 10:42 wheel
    drwxr-xr-x 2 insp_ap users 280 Apr 7 10:42 pip-9.0.1.dist-info
    drwxr-xr-x 11 insp_ap users 648 Apr 7 10:42 pip
    drwxr-xr-x 4 insp_ap users 96 Apr 7 10:50 Django-1.11.11-py3.6.egg
    -rw-r--r-- 1 insp_ap users 510240 Apr 7 10:56 pytz-2018.3-py3.6.egg
    -rw-r--r-- 1 insp_ap users 51 Apr 7 10:56 easy-install.pth
    (monitor2) insp_ap@inspect01:~/project/hanqin/django/monitor2/lib/python3.6/site-packages>

    ~/project/hanqin/django/monitor2/lib/python3.6/site-packages> cat easy-install.pth
    ./Django-1.11.11-py3.6.egg
    ./pytz-2018.3-py3.6.egg




    由于用的是Oracle数据库,继续安装cx_Oracle,确保环境变量.bash_profile下已经有如下ORACLE配置

    export ORACLE_SID=inspdb
    export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
    export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$JAVA_HOME/bin

    insp_ap@inspect01:~/project/hanqin/django/monitor2/tmp> pwd
    /home/insp_ap/project/hanqin/django/monitor2/tmp
    insp_ap@inspect01:~/project/hanqin/django/monitor2/tmp> ls cx_Oracle-6.0.3.tar.gz
    cx_Oracle-6.0.3.tar.gz

    解压后使用命令  python3 setup.py install
    running install
    running bdist_egg
    running egg_info
    writing cx_Oracle.egg-info/PKG-INFO
    writing dependency_links to cx_Oracle.egg-info/dependency_links.txt
    writing top-level names to cx_Oracle.egg-info/top_level.txt
    reading manifest file 'cx_Oracle.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'odpi/test'
    no previously-included directories found matching 'odpi/samples'
    writing manifest file 'cx_Oracle.egg-info/SOURCES.txt'
    installing library code to build/bdist.linux-x86_64/egg
    running install_lib
    running build_ext
    building 'cx_Oracle' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iodpi/include -Iodpi/src -I/usr/local/include/python3.6m -c src/cx_Oracle.c -o build/temp.linux-x86_64-3.6/src/cx_Oracle.o -DBUILD_VERSION=6.0.3
    src/Cursor.c: In function 'Cursor_MultiFetch':
    src/Cursor.c:1582: warning: 'found' may be used uninitialized in this function
    creating build/lib.linux-x86_64-3.6
    gcc -pthread -shared build/temp.linux-x86_64-3.6/src/cx_Oracle.o -o build/lib.linux-x86_64-3.6/cx_Oracle.cpython-36m-x86_64-linux-gnu.so
    creating build/bdist.linux-x86_64
    creating build/bdist.linux-x86_64/egg
    copying build/lib.linux-x86_64-3.6/cx_Oracle.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
    creating stub loader for cx_Oracle.cpython-36m-x86_64-linux-gnu.so
    byte-compiling build/bdist.linux-x86_64/egg/cx_Oracle.py to cx_Oracle.cpython-36.pyc
    installing package data to build/bdist.linux-x86_64/egg
    running install_data
    creating build/bdist.linux-x86_64/egg/cx_Oracle-doc
    copying LICENSE.txt -> build/bdist.linux-x86_64/egg/cx_Oracle-doc
    copying README.txt -> build/bdist.linux-x86_64/egg/cx_Oracle-doc
    creating build/bdist.linux-x86_64/egg/EGG-INFO
    copying cx_Oracle.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying cx_Oracle.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying cx_Oracle.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying cx_Oracle.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
    zip_safe flag not set; analyzing archive contents...
    __pycache__.cx_Oracle.cpython-36: module references __file__
    creating dist
    creating 'dist/cx_Oracle-6.0.3-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
    removing 'build/bdist.linux-x86_64/egg' (and everything under it)
    Processing cx_Oracle-6.0.3-py3.6-linux-x86_64.egg
    creating /home/insp_ap/project/hanqin/django/monitor2/lib/python3.6/site-packages/cx_Oracle-6.0.3-py3.6-linux-x86_64.egg
    Extracting cx_Oracle-6.0.3-py3.6-linux-x86_64.egg to /home/insp_ap/project/hanqin/django/monitor2/lib/python3.6/site-packages
    Adding cx-Oracle 6.0.3 to easy-install.pth file
    
    Installed /home/insp_ap/project/hanqin/django/monitor2/lib/python3.6/site-packages/cx_Oracle-6.0.3-py3.6-linux-x86_64.egg
    Processing dependencies for cx-Oracle==6.0.3
    Finished processing dependencies for cx-Oracle==6.0.3

    可以看到安装完成并未报错

  • 相关阅读:
    推荐:《TestDrive ASP.NET MVC》 节选与作者访谈
    30天敏捷结果(15):让自己处于宁静状态
    MDSF:如何使用GMF来做TOGAF建模工具
    强烈推荐:好书、好人、好谚语
    推荐:50个加强表单的jQuery插件
    101与金根回顾敏捷个人:(1)基于MBTI模型发现你的职业性格
    30天敏捷结果(19):你在为谁做事?
    30天敏捷生活(13):获得他人的反馈
    SourceForge.net上的新项目(2005/07/05)
    Open License,开源的许可生成器,实现你自己的许可管理器/应用
  • 原文地址:https://www.cnblogs.com/qinhan/p/8732626.html
Copyright © 2011-2022 走看看