[Bug 1814653] Re: get_python_lib() returns path to python3 instead of python3.6

Launchpad Bug Tracker 1814653 at bugs.launchpad.net
Tue Feb 5 11:10:49 UTC 2019


Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: python3-defaults (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1814653

Title:
   get_python_lib() returns path to python3 instead of python3.6

Status in python3-defaults package in Ubuntu:
  Confirmed

Bug description:
  Python version is Python 3.6.7 (default, Oct 22 2018, 11:32:17)
  Ubuntu 18.04.01

  When I call get_python_lib() function to get the Python lib path to install a module it returns '/usr/lib/python3/dist-packages' instead of python3.6 dir:
  python3 -c "from distutils.sysconfig import *;print(get_python_lib())"

  
  This is because the source code '/usr/lib/python3.6/distutils/sysconfig.py' has the branch on Ubuntu:

  Code:
  ------------
      if os.name == "posix":
          libpython = os.path.join(prefix,
                                   "lib", "python" + get_python_version())
          if standard_lib:
              return libpython
          elif (is_default_prefix and
                'PYTHONUSERBASE' not in os.environ and
                'VIRTUAL_ENV' not in os.environ and
                'real_prefix' not in sys.__dict__ and
                sys.prefix == sys.base_prefix):
              return os.path.join(prefix, "lib", "python3", "dist-packages")
  ------------

  However, this code does not present in the original cpython code 3.6.7:
  https://github.com/python/cpython/blob/ca7d2933a388677cc3bbc621913b479452c0f25a/Lib/distutils/sysconfig.py#L109

  Is it the right behavior?

  Why the get_python_lib() result should depend on PYTHONUSERBASE and
  VIRTUAL_ENV and points to python3 instead of python3.6

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: python3 3.6.7-1~18.04
  ProcVersionSignature: Ubuntu 4.15.0-44.47-generic 4.15.18
  Uname: Linux 4.15.0-44-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.3
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Tue Feb  5 12:41:28 2019
  InstallationDate: Installed on 2018-09-06 (151 days ago)
  InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
  SourcePackage: python3-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1814653/+subscriptions



More information about the foundations-bugs mailing list