Django installation first time

前端 未结 4 1917
野的像风
野的像风 2020-12-16 04:59

I started learning DJango for the first time. I have some amount of basic knowledge of python but DJango is first for me. I started with the documentation page of django, bu

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 05:37

    The most flexbile way, IMO, of installing w/o old setuptools, is

    1. download virtualenv
      $ curl -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.1.2.tar.gz
    2. extract
      tar xzf virtualenv-1.7.1.2.tar.gz
    3. use the version of Python you want to run Django to install virtualenv, for example
      $ python2.7 virtualenv-1.7.1.2/virtualenv.py --distribute ~/env
    4. enter env in which the pip has been already installed
      $ source ~/env/bin/activate
    5. install packages in current env instead of polluting global space or needing sudo
      pip install Django
      Then Django will be installed to path like ~/env/lib/python2.7/site-packages/django.
    6. Or you could
      pip install -e svn+http://code.djangoproject.com/svn/django/trunk
      to install latest trunk code of Django, and the source will be in ~/env/src/django/django. Then you are free to read the source or modify it. Also, you could have full documents by make html in ~/env/src/django/docs

    Things installed by the above method are totally local, you don't need to type sudo or take the risk of messing up paths such as /usr/local/lib, even more, you could then be able to install multiple versions of Django or Python w/o affect each other!

    Furthermore, you could try virtualenvwrapper.

提交回复
热议问题