diff --git a/etc/pyenv.d/which/system-site-packages.bash b/etc/pyenv.d/which/system-site-packages.bash index 6bfb0aa..8283793 100644 --- a/etc/pyenv.d/which/system-site-packages.bash +++ b/etc/pyenv.d/which/system-site-packages.bash @@ -37,8 +37,12 @@ if [ ! -x "${PYENV_COMMAND_PATH}" ]; then if [ ! -f "${no_global_site_packages}" ]; then include_system_site_packages=1 fi + virtualenv_orig_prefix="$(find "${virtualenv_libpath}/" -maxdepth 2 -type f -and -name "orig-prefix.txt" 2>/dev/null | head -1)" + if [ -f "${virtualenv_orig_prefix}" ]; then + virtualenv_prefix="$(cat "${virtualenv_orig_prefix}" 2>/dev/null || true)" + fi fi - if [ -n "${include_system_site_packages}" ]; then + if [ -n "${include_system_site_packages}" ] && [ -n "${virtualenv_prefix}" ]; then # virtualenv is created with `--system-site-packages` virtualenv_command_path="${virtualenv_prefix}/bin/${PYENV_COMMAND_PATH##*/}" if [ -x "${virtualenv_command_path}" ]; then