Friday, February 18, 2022

[SOLVED] MacOS Python 3.7 virtualenv fails?

Issue

My system is running MacOS and Homebrew and it recently updated to Python 3.7.

Now, just creating a new virtualenv and trying to use it fails.

FYI, I don't actually need Python 3.7. I didn't upgrade on purpose. I'd prefer the latest stable, supported version, but of course, I want the basics working.

➜  rm -rf ~/.virtualenvs/test
➜  python3 -m venv ~/.virtualenvs/test
➜  vex --path ~/.virtualenvs/test python
zsh: /usr/local/bin/vex: bad interpreter: /usr/local/opt/python/bin/python3.6: no such file or directory

➜  python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Solution

/usr/local/bin/vex file has this as the first line: #!/usr/local/opt/python/bin/python3.6; it's called shebang and it points operating system to the interpreter to run the script. You've uninstalled python3.6 so OS cannot find said interpreter. You need to reinstall vex with python3.7.



Answered By - phd
Answer Checked By - David Marino (WPSolving Volunteer)