Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using a particular python binary with venv

46 views
Skip to first unread message

greenba...@gmail.com

unread,
Jun 1, 2015, 5:34:10 PM6/1/15
to
According to this https://docs.python.org/3.4/library/venv.html#module-venv 'Each virtual environment has its own Python binary (allowing creation of environments with various Python versions)'
So how would I create a virtual environment using the venv module that has a Python 2.7 binary?
tia
g

Ian Kelly

unread,
Jun 1, 2015, 5:39:54 PM6/1/15
to Python
On Mon, Jun 1, 2015 at 3:33 PM, <greenba...@gmail.com> wrote:
> According to this https://docs.python.org/3.4/library/venv.html#module-venv 'Each virtual environment has its own Python binary (allowing creation of environments with various Python versions)'
> So how would I create a virtual environment using the venv module that has a Python 2.7 binary?

I wouldn't recommend trying to create a venv virtual environment using
Python 2.7, because venv was only added to the standard library in
Python 3.3. Use the third-party virtualenv instead.

Carl Meyer

unread,
Jun 1, 2015, 5:43:37 PM6/1/15
to pytho...@python.org
You can't. The venv module only exists in and supports Python 3.3+.

If you need to support earlier Django versions, you'll need to use the
older "virtualenv" library instead, which looks very similar from the
end-user side. See https://virtualenv.pypa.io/en/latest/

Carl

signature.asc

Laura Creighton

unread,
Jun 1, 2015, 5:46:11 PM6/1/15
to greenba...@gmail.com, pytho...@python.org, l...@openend.se
In a message of Mon, 01 Jun 2015 14:33:56 -0700, greenba...@gmail.com writ
es:
>--
>https://mail.python.org/mailman/listinfo/python-list

#If you haven't already got it
pip install virtualenv

#Then

cd where_I_want_to_work
virtualenv -p /usr/bin/python2.7 venv
source venv/bin/activate
pip install packages_i_need

# when you are done
deactivate

to get back to your system python.

Laura

greenba...@gmail.com

unread,
Jun 1, 2015, 6:07:42 PM6/1/15
to
On Tuesday, 2 June 2015 09:43:37 UTC+12, Carl Meyer wrote:
Thanks Carl
I am guessing that the documentation needs to be altered then. I will submit a documentation bug...
cheers
g

Carl Meyer

unread,
Jun 1, 2015, 6:19:38 PM6/1/15
to pytho...@python.org
On 06/01/2015 04:07 PM, greenba...@gmail.com wrote:
> On Tuesday, 2 June 2015 09:43:37 UTC+12, Carl Meyer wrote:
>> On 06/01/2015 03:33 PM, orotau wrote:
>>> According to this
>>> https://docs.python.org/3.4/library/venv.html#module-venv 'Each
>>> virtual environment has its own Python binary (allowing creation of
>>> environments with various Python versions)'
>>>
>>> So how would I create a virtual environment using the venv module
>>> that has a Python 2.7 binary?
>>
>> You can't. The venv module only exists in and supports Python 3.3+.
>>
>> If you need to support earlier Django versions, you'll need to use the
>> older "virtualenv" library instead, which looks very similar from the
>> end-user side. See https://virtualenv.pypa.io/en/latest/
>
> Thanks Carl
> I am guessing that the documentation needs to be altered then. I will submit a documentation bug...

I think the documentation is accurate as written (you _can_ create
environments with various Python versions, they just have to be versions
that include and support the venv module), but a clarification on the
supported Python versions in that sentence seems reasonable to me.

Carl

signature.asc

greenba...@gmail.com

unread,
Jun 1, 2015, 6:23:13 PM6/1/15
to
0 new messages