[prev in list] [next in list] [prev in thread] [next in thread]
List: macports-users
Subject: Re: Upgrading python from 27 to 36
From: Russell Jones <russell.jones () physics ! ox ! ac ! uk>
Date: 2017-04-27 16:11:52
Message-ID: 1838a857-f4b3-d258-391e-88b3dbba0783 () physics ! ox ! ac ! uk
[Download RAW message or body]
On which interpreter is used, you can control this with (IIRC) something
like
port select --set python3 python3.6
port select --set python2 python2.7
port select --set python python2
# or "port select --set python python3" if you like
It's most flexible to say #!/usr/bin/env python2 or #!/usr/bin/env
python3 in scripts (rather than, say, #!/opt/local/bin/python or
#!/usr/bin/env python), as this ensures the right major version, and
will use an enabled virtualenv's copy of the interpreter.
#!/opt/local/bin/python3 would work too.
Don't forget there's also /usr/bin/python and /usr/bin/python2.7. These
are best avoided.
> The Apple-provided build of Python is installed in
> /System/Library/Frameworks/Python.framework and /usr/bin/python,
> respectively. You should never modify or delete these, as they are
> Apple-controlled and are used by Apple- or third-party software.
> Remember that if you choose to install a newer Python version from
> python.org, you will have two different but functional Python
> installations on your computer, so it will be important that your
> paths and usages are consistent with what you want to do.
https://docs.python.org/2/using/mac.html
Russell
On 27/04/17 14:38, Russell Jones wrote:
> In short, most stuff works with 2 and 3, and you should use 3. You can
> install both, they're independent. virtualenvs are your friend. Also,
> "import this" if you haven't already :)
>
> In full, it's quite complex. See
> https://wiki.python.org/moin/Python2orPython3
>
> For most features and least hassle, use 3 and ignore 2 if you can. If
> you have old 2 code of your own, have a look at http://python-future.org/
>
> Stuff being 2 only is a bit of a red flag. It's likely unmaintained or
> has architectural or testing problems such that it can't be ported.
> Some newer stuff is 3 only-- typically to rely on new 3 only features
> like asyncio. 2 and 3 stuff is so because of some effort by the
> developers to make it so.
>
> Russell
>
> On 26/04/17 20:59, Michael wrote:
>> What is involved in switching from python 27 to python 36?
>>
>> I've been using python 27 for a while. I've run into a problem with
>> youtube-dl needing a newer python.
>>
>> But I don't know what I need to do to safely update. It's not like
>> python2 is a different program than python3 (same "python" in both
>> cases), and as I understand it, not everything written for P2 is
>> compatible with P3.
>>
>> So what's the proper way to upgrade?
>> Or is there a way to have both installed at the same time? (but then
>> ... !#/usr/bin/env python ...)
>>
>> ---
>> Entertaining minecraft videos
>> http://YouTube.com/keybounce
>>
>> _______________________________________________
>> macports-users mailing list
>> macports-users@lists.macosforge.org
>> https://lists.macosforge.org/mailman/listinfo/macports-users
>
> _______________________________________________
> macports-users mailing list
> macports-users@lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-users
_______________________________________________
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic