pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

pyenv-virtualenv command not found

Open itzbhushan opened this issue 7 years ago • 2 comments

I'm using oh-my-zsh and tried the following in centos/ubuntu.

Step 1: I first installed pyenv using the following command:

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

This step also seems to have installed pyenv-virtualenv because ~/.pyenv/plugins/pyenv-virtualenv is created.

Step 2: Updated ~/.zshenv:

export PATH="/home/bmohan/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Step 3: Started a new ssh session and tested pyenv

pyenv 1.2.4
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme

However, when I try:

➜  which pyenv-virtualenv
pyenv-virtualenv not found

Can anyone point out what's wrong?

itzbhushan avatar May 31 '18 16:05 itzbhushan

The correct command is pyenv virtualenv.

thomasjo avatar May 31 '18 21:05 thomasjo

Thank you, @thomasjo Yes, I notice that pyenv virtualenv works. I'm using direnv over pyenv-virtualenv and the README for direnv uses pyenv-virtualenv. Specifically, the layout_virtualenv() in the + pyenv-virtualenv section has the following check:

layout_virtualenv() {
    local pyversion=$1
    local pvenv=$2
    if [ -n "$(which pyenv-virtualenv)" ]; then
        pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion}
    fi
    pyenv local --unset
}

Should the condition be changed from $(which pyenv-virtualenv) to $(which pyenv virtualenv)?

itzbhushan avatar May 31 '18 22:05 itzbhushan