简体   繁体   中英

python virtualenvwrapper bad interpreter

I recently upgrade from python 3.5 to python 3.6 (with brew on macOS). However virtualenvwrapper now seems to be broken and I get the error. A reinstall didn't help unfortunately.

mkvirtualenv:78: /usr/local/bin/virtualenv: bad interpreter: /usr/local/opt/python3/bin/python3.5: no such file or directory

I have VIRTUALENV_PYTHON=python3 set so the default is to install a virtualenv with python3.

  1. open the terminal use which python3.6 to show the path of python3.6
  2. open the file /usr/local/bin/virtualenv
  3. change the first line which starts with #! with the path of python3.6 before

For me, it was because there were spaces in some of the directory names and virtualenv did not parse the path correctly. To be safe, just remove spaces from the directory names and replace them with - or _ and it should work fine :)

Use: pip install --upgrade virtualenv

OR: sudo pip install -U --force-reinstall virtualenv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM