When I run mkvirtualenv TESTING
:
New python executable in TESTING/bin/python2.7
Also creating executable in TESTING/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts could not run "/Users/admin/.virtualenvs/TESTING/bin/preactivate": [Errno 2] No such file or directory
A similar error appears when I run lsvirtualenv
:
bpython-dev
===========
virtualenvwrapper.user_scripts could not run
"/Users/admin/.virtualenvs/bpython-dev/bin/get_env_details": [Errno 2] No such file or directory
I've checked into the .virtualenvs/bpython-dev/ (and other virtual envs) to see if get_env_details is there, and it is.
This problem happened after I performed Migration Assistant with Time Machine on Mavericks.
I'm using Python 2 installed with Homebrew.
which python
yields usr/local/bin/python
and which pip
yields usr/local/bin/pip
.
My .bash_profile
:
# Load /usr/local/ before /usr/bin/
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/bin:$PATH
# Load the default .profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
# Virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Hacker\ School/
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh
# Timing terminal directory tracking
PROMPT_TITLE='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
export PROMPT_COMMAND="${PROMPT_COMMAND} ${PROMPT_TITLE}; "
export DJANGO_COLORS="dark"
# _django_completion()
# {
# COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
# COMP_CWORD=$COMP_CWORD \
# DJANGO_AUTO_COMPLETE=1 $1 ) )
# }
# complete -F _django_completion -o default django-admin.py manage.py django-admin
# _python_django_completion()
# {
# if [[ ${COMP_CWORD} -ge 2 ]]; then
# PYTHON_EXE=${COMP_WORDS[0]##*/}
# echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1
# if [[ $? == 0 ]]; then
# PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
# echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
# if [[ $? == 0 ]]; then
# COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
# COMP_CWORD=$(( COMP_CWORD-1 )) \
# DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
# fi
# fi
# fi
# }
# # Support for multiple interpreters.
# unset pythons
# if command -v whereis &>/dev/null; then
# python_interpreters=$(whereis python | cut -d " " -f 2-)
# for python in $python_interpreters; do
# pythons="${pythons} ${python##*/}"
# done
# pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
# else
# pythons=python
# fi
# complete -F _python_django_completion -o default $pythons
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="usr/local/Cellar/python/2.7.10_2/bin/:${PATH}"
export PATH
# Homebrew, OpenCV
export PATH="/usr/local/Cellar/opencv/2.4.9/lib/python2.7:$PATH"
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
It's a bit late for an actual answer but I hope it helps someone with the same problem in the future.
What actually happened:
I did a fresh install of the OS.
I used Migration Assistant to migrate my data from Time Machine. I believe this step corrupted my environment and paths.
The solution was to use macOS Recovery and choose "Restore from Time Machine".