Pipenv: Documentation on how to work interactively with multiple python versions

Created on 21 Apr 2018  路  7Comments  路  Source: pypa/pipenv

I work on packages I'd like to run in multiple versions of python. How do you recommend interactively debugging a package with multiple python versions? Could there be a bit of documentation added about how to maintain virtualenvs for both py2 and py3, for working in 2/3 compatible packages, with some workflow guidance? Thanks.


Related issues: https://github.com/pypa/pipenv/issues/1071 https://github.com/pypa/pipenv/issues/1050

Type Type help wanted

All 7 comments

Create virtualenvs manually, and use environment variable PIPENV_VIRTUALENV to point to the one you want to use. This would be nice to be put in the Advanced documentation. Contribution welcomed!

I actually forget about this all the time and just wipe my environment and reinstall it with a different version

hm this doesn't actually work, that's just an internal variable, not an actual environment variable we accept. You can however just manually create and activate virtualenvs which is what I do

er wrong button, still should document

It would be great to have this documentation because I would like to use it for https://github.com/asweigart/pyautogui which has to support both Python 2 and Python 3.

@afs2015 the actual usage of this described above. PIPENV_VIRTUALENV is just a string that gets postfixed onto the virtualenv name that pipenv creates, so if you're using something like travis or tox to manage your virtualenvs you could set the python version in the environment e.g. PYTHON_VERSION=2.7, and then you could set PIPENV_VIRTUALENV="$PYTHON_VERSION" -- this will make pipenv <command> use <virtualenvname>-2.7 until you change the variable.

Another workaround is to manually activate the virtual environment you want, and use Pipenv inside it. Pipenv should pick up the surrounding environment automatically.

Was this page helpful?
0 / 5 - 0 ratings