These are the steps I did:
- Created a virtual env using
python3 -m venv myvenv
- Activate the virtual env using
myvenv/bin/activate
- Run
python -m pip install --upgrade pip
, to upgrade pip. - run
pip install -r requirements.txt
- It throws an error:
bash: /Users/vince/Django Projects/test/myvenv/bin/pip: "/Users/vince/Django: bad interpreter: No such file or directory
When I tried using pip2 install, it works, why is that so?
Is there something I missed?
Advertisement
Answer
The file /Users/vince/Django Projects/test/myvenv/bin/pip
starts with shebang /Users/vince/Django Projects/test/myvenv/bin/python
(look it up). The problem is the path contains a space in its name and shebangs are not allowed to have spaces.
Remove the virtualenv, it’s unusable. Recreate it under a path that doesn’t have spaces and other fancy characters.
Upd. You can run scripts manually:
"/Users/vince/Django Projects/test/myvenv/bin/python" "/Users/vince/Django Projects/test/myvenv/bin/pip"
But that’s painful.