0

Few days ago MacOS removed Python2. So I installed it with pyenv but fab is not working.

Config in .zshrc:

...
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOME/.pyenv/bin:$PATH"
export PIPENV_PYTHON="$PYENV_ROOT/shims/python"

eval "$(pyenv init -)"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

alias python="$(pyenv which python)"
alias pip="$(pyenv which pip)"

I've created virtualenv with pyenv virtualenv 2.7.18 myenv. Activated it with pyenv activate myenv and also tried pyenv local myenv, pyenv local myenv 2.7.18 and bunch of other similar commands.

I also checked if fabric is installed with

$ pip freeze 

... 
Fabric==1.14.0
...
$ fab start                                                                                                                                                          
pyenv: fab: command not found

The `fab' command exists in these Python versions:
  2.7.18

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.

How do I use fab commands with pyenv?

aplaninsek
  • 134
  • 2
  • 11

1 Answers1

0

as for me I use my own Shell script named fab as:

#!/bin/sh

SCRIPT_PATH=`readlink -f $0`
SCRIPT_DIR=`dirname "$SCRIPT_PATH"`

if [ ! -d "$SCRIPT_DIR/_venv" ]; then
    python3 -m venv "$SCRIPT_DIR/_venv"
    "$SCRIPT_DIR"/_venv/bin/pip install -r "$SCRIPT_DIR"/requirements.txt
fi

"$SCRIPT_DIR"/_venv/bin/fab $*
RandomB
  • 3,367
  • 19
  • 30