Installed Virtualenv and activating virtualenv doesn't work

前端 未结 5 544
时光说笑
时光说笑 2021-02-04 06:59

I cloned my Django Project from Github Account and activated the virtualenv using famous command source nameofenv/bin/activate And when I run python manage.py

5条回答
  •  渐次进展
    2021-02-04 07:17

    I was thinking that every and each dependency I need, might be present inside virtualenv.

    Well, no. By default, a newly created virtualenv comes empty, that is, with no third-party library. (Optionaly, you may allow a virtualenv to access libraries installed system-wide, but that's another story.)

    Once the virtualenv is created, you need to install the dependencies you need.

    (How could virtualenv know what dependencies you need?)

    The procedure is to install the virtualenv, activate it, and then install the libraries needed for the project (in you case Django and perhaps others).

    If you project has a requirements.txt, you may install every required dependency with the command:

    pip install -r requirements.txt
    

    If your project has a setup.py, you may also execute

    pip install -e path/to/your/project/clone/.
    

    to install the project in the virtualenv. This should install the dependencies.

    Of course, if the only dependency is Django, you can just type

    pip install django
    

提交回复
热议问题