31

I am trying to use virtualenv to create a virtual python environment on my mac. I have downloaded virtualenv however I can't run it because it can't find the path to my installation of python3 even though I am supplying the correct path. Here is the command I have run and the response:

virtualenv --python=/usr/local/bin/python3 newfolder
zsh: /usr/local/bin/virtualenv: bad interpreter: /usr/local/opt/python3/bin/python3.6: no such file or directory

Also I have tried running the command with quotes like so:

virtualenv --python='/usr/local/bin/python3' newfolder
zsh: /usr/local/bin/virtualenv: bad interpreter: /usr/local/opt/python3/bin/python3.6: no such file or directory

Please note I am supplying the correct path to python3 as far as I can tell.
Here is what I get when I run which python3

which python3
/usr/local/bin/python3

Also virtualenv appears to be correctly installed. Here is evidence for this:

pip3 install virtualenv
Requirement already satisfied: virtualenv in /Users/mathewlewis/Library/Python/3.7/lib/python/site-packages (16.7.9)

Also, in case this is relevant, the software I have is currently mac os catalina 10.15.2

Not only would I like a solution (as has been given at this point) I would also like a reason why this didn't work.

1
  • This is very suspect. Your pip3 is associated with a Python 3.7 instance, but your python3 is associated with a Python 3.6 instance. Commented Jan 8, 2020 at 0:48

2 Answers 2

90

Try:

python3 -m venv venv
source ./venv/bin/activate
Sign up to request clarification or add additional context in comments.

Comments

4

Your virtualenv script uses bad interpreter /usr/local/opt/python3/bin/python3.6 which you have had installed and later removed. To fix the script reinstall virtualenv package using an existing Python:

pip3 install -U virtualenv

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.