try to fix for pyenv/virtualenv: completion/available/pip.completion.bash

pull/1518/head
Hongyi Zhao 2020-03-11 20:00:27 +08:00
parent b35d41464c
commit 9fcaab0efc
1 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,14 @@
# If the pip package is installed within virtual environments, say, python managed by pyenv,
# you should first initilization the corresponding environment.
# So that the pip/pip3 is in system's path.
if command -v pip >/dev/null; then
eval "$(pip completion --bash)"
# For the pyenv-based environment:
if which pyenv >/dev/null; then
if pyenv which pip 2>/dev/null; then
eval "$(pip completion --bash)"
fi
else
if command -v pip >/dev/null; then
eval "$(pip completion --bash)"
fi
fi