I'm trying to get Python 2.7 to play nicely with pyenv and virtualenv on OSX El Capitan. I've installed pyenv
with Homebrew, then Python 2.7.11 with pyenv install 2.7.11
. This describes the setup:
$ which python
/usr/local/bin/python
$ which virtualenv
/usr/local/bin/virtualenv
$ head -1 /usr/local/bin/virtualenv
#!/usr/local/bin/python
$ which pip
/Users/username/bin/pip
$ head -1 /Users/robinedwards/bin/pip
#!/usr/local/bin/python
$ pyenv install --list | grep 2.7.11
2.7.11
.bashrc
contains lines:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Now when I try to create a new virtualenv project:
$ pyenv virtualenv 2.7.11 newproject
pyenv: pip: command not found
Any idea what I'm doing wrong?
pyenv is a collection of shell scripts and not installable with pip. See installation instructions for more information.
The pip: command not found error is raised if you do not have pip installed on your system, or if you've accidentally used the pip command instead of pip3. To solve this error, make sure you have installed both Python 3 and pip3 onto your system.
Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.
I'm not sure if that solution matches the problem, but after installing pyenv, pyenv-virtualenv and selecting a python version, I had to run pip
that way:
$ pyenv exec pip install
I had the same error message. The problem was due to a failed installation of a python version, so pip
wasn't found for this version. In fact, even python
wasn't found.
example:
pyenv install 3.7.2 # this failed, but I did not realize it failed at first
pyenv versions | grep 3.7.2
3.7.2
pyenv local 3.7.2
python --version
pyenv: python: command not found
So problem was not with pip
itself, but a broken installation of a python version. Just make sure you succeed when you install a python version with pyenv
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With