How to run both python 2.6 and 3.0 on the same windows XP window?

What kind of customization do people use to run both python 2.6 and python 3.0 on the same windows machine?

+3
source share
5 answers

Virtualenv is the choice of choice on Unix and Mac platforms.

virtualenv is a tool for creating sandboxed Python environments.

, , . , 1 LibFoo, 2. ? /usr/lib/python 2.4/site-packages ( ), , , .

, , , ? , .

, , ? , .

, , Windows, , Windows.

+1

, ​​ . Windows C:\Python26\ C:\Python31\. "" . Python ActiveState.

- .

C:\> C:\Python25\python ver.py
2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]

C:\> C:\Python31\python ver.py
3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]

ver.py:

import sys
print (sys.version)
+9

- .

-Eclipse pydev , .

-Re- .py/.pyw .

+1

, 3.0 (print()) .., 2.5 2.6.

Python __future__ " " , Python, - :

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
>>> from __future__ import print_function
>>> print("Example", end=" Hurray!\n")
Example Hurray!

Python 3.0 , Unicode:

>>> from __future__ import unicode_literals
>>> type('abc')
<type 'unicode'>
>>> 'a'
u'a'

Python 2.6, (, with_statement). , , from __future__ import braces, "C like" if(){} braces

+1

Why would you want to do that? Everything in 3.0 is in version 2.6, you can use the new features in version 3.0 with from __future__ import. Run 2.6 until you are ready to upgrade to 3.0 for everyone, and then upgrade. You are not going to have multiple versions of Python on the same computer. If you really want to, you can specify alternative installation directories, but I really don’t understand how it is worth what it takes.

0
source

Source: https://habr.com/ru/post/1719205/


All Articles