python3.7 installation failing - so why?
On Sat, Feb 23, 2019 at 4:41 PM Frank Miles <pedicularis at mail.com> wrote:
> On Sat, 23 Feb 2019 14:56:03 +1100, Chris Angelico wrote:
> > On Sat, Feb 23, 2019 at 2:51 PM Frank Miles <pedicularis at mail.com>
> > wrote:
> >> I have a Debian/Linux machine that I just upgraded to the newer
> >> "testing"
> >> distribution. I'd done that earlier to another machine and all went
> >> well. With the latest machine, python2 is OK but python3 can barely
> >> run at all. For example:
> >> $ python3 Python 3.7.2+ (default, Feb 2 2019, 14:31:48)
> >> [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license"
> >> for more information.
> >> >>> help()
> >> Traceback (most recent call last):
> >> File "<stdin>", line 1, in <module>
> >> File "/usr/lib/python3.7/_sitebuiltins.py", line 102, in __call__
> >> import pydoc
> >> File "/usr/lib/python3.7/pydoc.py", line 66, in <module>
> >> import inspect
> >> File "/usr/lib/python3.7/inspect.py", line 40, in <module>
> >> import linecache
> >> File "/usr/lib/python3.7/linecache.py", line 11, in <module>
> >> import tokenize
> >> File "/usr/lib/python3.7/tokenize.py", line 33, in <module>
> >> import re
> >> File "/usr/lib/python3.7/re.py", line 143, in <module>
> >> class RegexFlag(enum.IntFlag):
> >> AttributeError: module 'enum' has no attribute 'IntFlag'
> >> >>>
> >> >>>
> >> Question: how can I determine what has gone wrong?
> > Hmm. I'd start with:
> > $ which python3 $ dpkg -S `which python3`
> > and from inside Python:
> >>>> import sys; sys.path import enum; enum.__file__
> > My best guess at the moment is that your "enum" package is actually a
> > compatibility shim for earlier Python versions, less functional than the
> > one provided by Python 3.7. You may need to *uninstall* a shim package.
> > But I could well be wrong, and maybe there'd be a clue in your paths.
> > ChrisA
> Whoopee! You nailed it!
> The path included /usr/local/lib/python3.7/dist-packages, which included
> an enum file as you suggested. The 'import enum; enum.__file__' (gonna
> have to look up that syntax) provided with the path to that directory.
> Many thanks Chris for a most helpful suggestion!
Cool! Glad that's working.
There's nothing very special about the syntax per se - it's just
looking up an attribute on the 'enum' module. What's special is that
every module has an attribute called "__file__" which says which file
it was loaded from (if any - there's no "sys.__file__" because the sys
module comes from deep inside Python's core). Extremely handy.