Nie Selam
Nie Selam

Reputation: 1451

Couldn't import Django when moving whole virtualenv from windows to mac

It worked fine between windows OS but not in the mac. I didn't have requirements.txt file but was hoping the virtual environment with a lot of libraries imported by two developers would work just fine.

runserver generates error couldnt import django. Any ideas?

Upvotes: 2

Views: 198

Answers (1)

FlipperPA
FlipperPA

Reputation: 14331

Virtualenvs sometimes include binaries and sometimes need to be created with flags so they can be moved. What I'd recommend:

  • Activate the virtualenv on the machine you have it working on
  • Run the command pip freeze > requirements.txt
  • Commit requirements.txt to version control
  • Pull it down on the target machine
  • Make a fresh virtualenv
  • pip install -r requirements.txt

The pip freeze command will also include dependencies installed, so you may want to clean it up, but that should give you a working version. Good luck!

Upvotes: 2

Related Questions