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
  • 相关阅读:
    序列化二叉树
    按之字形顺序打印二叉树
    C#读写文件的方法汇总_C#教程_脚本之家
    c#缓存介绍(转)
    ASP.NET 缓存技术分析
    pickle使用
    python3.4使用文件
    io的常用操作
    manven需要注意点几点
    git中一些常用的命令
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6481974.html
Copyright © 2011-2022 走看看