|Python3 venvs for people who are old and grumpy|
I've been using virtualenvwrapper to make venvs for python2 for probably six or so years. I know it, and understand it. Now some bad man (hi Ramon!) is making me do python3, and virtualenvwrapper just isn't a thing over there as best as I can tell.
So how do I make a venv? Its really not too bad...
First, install the dependencies:
git clone git://github.com/yyuu/pyenv.git .pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv source ~/.bashrc
Now to make a venv, do something like this (in this case, infrasot is the name of the venv):
mkdir -p ~/.virtualenvs/pyenv-infrasot cd ~/.virtualenvs/pyenv-infrasot pyenv virtualenv system infrasot
You can see your installed venvs like this:
$ pyenv versions * system (set by /home/user/.pyenv/version) infrasot
Where system is the system installed python, and not a venv. To activate and deactivate the venv, do this:
$ pyenv activate infrasot $ ... stuff you're doing ... $ pvenv deactivate
I'll probably write wrappers at some point so that this looks like virtualenvwrapper, but its good enough for now.
Tags for this post: python venv virtualenvwrapper python3
Related posts: SSL, X509, ASN.1 and certificate validity dates; Getting Google Talk working with PyXMPP; Universal Feedparser and XML namespaces; Twisted Python and Jabber SSL; More coding club; A pythonic example of recording metrics about ephemeral scripts with prometheus
posted at: 21:20 | path: /python | permanent link to this entry