zoukankan      html  css  js  c++  java
  • [Django] Get started with Django -- Install python and virtualenv

    Install python3 on MacOS:

    brew install python3

    Come alone with python3, there are also some other tools are installed as well, for examlpe: 'pip, setuptools'...

    We need 'pip' to help us install virtualenv.

    Why virtualenv?

    Main reason is to resolve the libaraies conflict for different django project. So for each project, you should create new virtual env, and install libraries only for this project, NEVER globally!

    Install:

    pip3 install virtualenv

    Before create a new virtual env, we need to check the python3 location:

    which python3

    And in my case, it is:

    /usr/local/bin/python3

    Create new virtual env:

    virtualenv -p /usr/local/bin/python3 myFirstProject

    Go to the env folder we just create and start working on this env:

    cd myFirstProject
    . bin/activate

    Now we are in the virtual env, we can start install django:

    pip install django

    To make sure and get familiar where those libraries are installed, we can go to:

    ls lib/python3.6/site-packages

    And you should be able to find django is there.

    And also you can type:

    python   // type paython
    
    >>> import django   // import django lib
    >>> django.VERSION // see the verison
    
    (1, 10, 5, 'final', 0) // prints out


    Other way to create new env with >python3.3 only:

    python3 -m venv demo

    Deactive you env:

    deactivate

    List all the libararies:

    pip list
  • 相关阅读:
    Jquery 下实现 图片大图预览效果
    PHP之图片上传类(加了缩略图)
    无限极分类
    inno steup 安装判断 进程是否运行
    mac os 10.15安装jdk 1.6
    c# 创建delphi的代码
    php 断点续传以及100% 后台zip解压
    多个编号重复,递归处理
    php映射echarts柱状图
    php数据映射到echarts中国地图
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6481974.html
Copyright © 2011-2022 走看看