Using sudo with pip3?

Chris Angelico rosuav at gmail.com
Sat Jan 7 19:22:02 EST 2017


On Sun, Jan 8, 2017 at 10:51 AM, Cameron Simpson <cs at zip.com.au> wrote:
> Here's an example:
>
>  $ mkdir ~/var ~/var/venv  # where I keep my virtualenvs
>  $ virtualenv -p /usr/bin/python3 --system-site-packages ~/var/venv/3
>  $ ~/var/venv/3/bin/python3    # invokes the virtualenv python3
>  $ ~/var/venv/3/bin/pip3       # invokes the virtualenv pip3
>  $ ln -s ~/var/venv/3/bin/python3 ~/bin/.  # make these my default
>  $ ln -s ~/var/venv/3/bin/pip3 ~/bin/.
>
> From this point on "pip3" should execute your own $HOME/bin/pip3, which
> comes from the virtualenv and installs in ~/var/venv/3/lib/...

Can you do the same with the standard library 'venv' module? I
generally recommend and prefer that over the third-party 'virtualenv',
which achieves what it does via a series of hacks.

ChrisA


More information about the Python-list mailing list