Search code examples
pythondjangomacosvirtualenv

Why can't I activate virualenv on Mac?


I'm was working on a project few months earlier that I hadn't modified in the las 3 months. During this period I changed my Macbook and transferred everything with Time Machine. My other projects that don't using virtualenv works fine but in case of this project I am not able to activate the virtualenv.

Structure:

coachregiszter
    --bin
    --include
    --lib
    --mcr (this is my project folder where manage.py is)
    --pyenv.cfg

If I try: source bin/acivate I get this error message:

source bin/activate
Script started, output file is started
Script: on: No such file or directory

Script done, output file is started
bin/activate:2: bad pattern: ^[[1m^[[7m%^[[27m^[[1m^[[0m

What is the problem?


Solution

  • Don't nest the virtual environment within the project—it shouldn't be in version control. Instead, include the requirements file to recreate the environment. Keep the project separate from the virtual environment; environments are disposable, and separating them allows flexibility (like testing on different versions of Django). Assume your directory is like Users/coachregiszter/mcr, your virtualenv can be Users/coachregiszter/.venv