Reputation: 2014
Trying to migrate from virtualenv
to venv
(python3). Also would like to use pyenv
to manage multiple versions of python 3.x on my Mac.
Following this article, I installed pyenv
, pyenv-virtualenv
and pyenv-virtualenvwrapper
via brew
without a problem:
brew install pyenv
brew install pyenv-virtualenv
brew install pyenv-virtualenvwrapper
Modified my .zsh_env.sh
in ~/.config/zsh_env.sh
like so:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/workspace
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Installed two Python versions:
➜ ~ pyenv versions
system
2.7.15
* 3.7.2 (set by /Users/ugur/.python-version)
Trying to create a virtual environment, but I get a complaint that pip
is missing:
➜ ~ pyenv virtualenv 3.7.2 jupyter3
pyenv: pip: command not found
The `pip' command exists in these Python versions:
2.7.15
If I try to run pip
in my terminal, I get the same error:
➜ ~ pip
pyenv: pip: command not found
The `pip' command exists in these Python versions:
2.7.15
pip3
seems to be installed/seen though:
➜ ~ pip3
Usage:
pip3 <command> [options]
Commands:
install Install packages.
download Download packages.
... (omitted)
How can I use pyenv
in combination with venv
to manage environments and python versions?
Tried to install pip
via pip3
like so (without success):
➜ ~ pip3 install pip
Requirement already satisfied: pip in ./.pyenv/versions/3.7.2/lib/python3.7/site-packages (18.1)
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ ~ pip install --upgrade pip
pyenv: pip: command not found
The `pip' command exists in these Python versions:
2.7.15
Not even aliasing pip helped:
➜ ~ alias pip=pip3
➜ ~ pyenv virtualenv 3.7.2 jupyter3
pyenv: pip: command not found
The `pip' command exists in these Python versions:
2.7.15
Upvotes: 1
Views: 4946
Reputation: 245
You can just create a similink as such
ln -s /usr/bin/pip3 /usr/bin/pip
Now calling pip
will actually be pip3
.
Note : This doenst work if python was installed with brew, as the directory isnt /usr/bin
, as pointed out in below comment.
Upvotes: 1