Problems with python3.6 on one system, but OK on another

dieter dieter at handshake.de
Mon Jan 23 03:42:12 EST 2017


Cecil Westerhof <Cecil at decebal.nl> writes:

> I build python3.6 on two systems. On one system everything is OK:
> Python 3.6.0 (default, Jan 21 2017, 11:19:56) 
> [GCC 4.9.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
>
> But on another I get:
> Could not find platform dependent libraries <exec_prefix>
> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
> Python 3.6.0 (default, Jan 21 2017, 12:20:38) 
> [GCC 4.8.5] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> Probably not a big problem, but just wondering what is happening here.
> On both systems PYTHONHOME is not set and with the old version (3.4.5)
> I did/do not get this message.

A Python installation consists of two parts: the Python binary
(i.e. the Python interpreter) and the Python runtime library
(everything not built into the interpreter itself).

When you start Python, you effectively start the binary. This
then tries to locate the parts forming its runtime library.
Essentially, there are two parts: platform independent (i.e. Python
modules/packages) and platform dependent (usually shared objects
implemented in "C" or "C++"). The binary is using heuristics
to locate those parts, involving the (usually internal) variables
"prefix" and "exec_prefix" for the platform independent and dependent parts,
respectively.

On some platforms, the operating system allows a binary to determine
the full path it has been started from. On those platforms,
the above mentioned heuristics may use this path to locate the
runtime library parts. On other platforms, default values for
"prefix" and "exec_prefix" are determined during the Python generation.


As a consequnece, something must have gone wrong with the
generation or installation of your badly behaving Python.

To start the investigation, I would look at the binaries'
notion of "prefix" and "exec_prefix". You can find them via
>>> import sys
>>> sys.prefix, sys.exec_prefix

On a "*nix" like platform, you should find
the platform dependent parts of the runtime library
unter "<exec_prefix>/lib/Python<version>/lib-dynload".

Check whether this directory exists and is not empty.





More information about the Python-list mailing list