pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.37k stars 402 forks source link

pyenv-virtualenvs and pyenv-virtualenv-prefix error when installed with symlink #307

Open andrew-christianson opened 5 years ago

andrew-christianson commented 5 years ago

The construction . "${BASH_SOURCE%/*}"/../libexec/pyenv-virtualenv-realpath, on line 9 of pyenv-virtualenv-prefix and line 10 of pyenv-virtualenvs results in an error if the script is symlinked into a directory on PATH (e.g. installed through Homebrew). Specifically, in the case of v1.1.5 installed through brew install --HEAD pyenv-virtualenv it reports:

/usr/local/bin/pyenv-virtualenvs: line 10: /usr/local/bin/../libexec/pyenv-virtualenv-realpath: No such file or directory

This can be solved by following the symlink if ${BASH_SOURCE} is indeed a link before expanding the path to pyenv-virtualenv-realpath; I'll submit a PR to that effect if that seems like the appropriate solution.

zzhou612 commented 5 years ago

Encountered the same problem.