Installed Virtualenv and activating virtualenv doesn't work

前端 未结 5 605
时光说笑
时光说笑 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:36

    I'm guessing you also upload the virtual environment from your other pc. And you hope that only activating that will work, bzz.

    It's not recommended to upload the virtualenv files to your git repository, as @Alain says it's a good practice to have a requirements.txt file containing the project dependencies. You can use pip freeze > requirements.txt (when the environment is activated) to generate the project requirements file.

    By doing so, when you clone the repository from another computer, you need to create a new virtualenv by issuing the command:

    virtualenv nameofenv
    

    then activate it:

    source nameofenv/bin/activate
    

    and finally, use the requirements file to install the requirements for your project using:

    pip install -r requirements.txt
    

提交回复
热议问题