msg302032 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2017-09-13 08:01 |
In python --help: PYTHONHOME : alternate directory (or :<exec_prefix>). The default module search path uses /pythonX.X. I think the default module search path should be /lib/pythonX.X. |
|
|
msg302338 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2017-09-16 13:48 |
You are right, the path is wrong on Unix-like platforms. It's os.path.join(sys.prefix, 'lib', 'python{major}.{minor}'). But the actual path may depend on the platform, too. I don't recall how Windows sets up the path. |
|
|
msg302339 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2017-09-16 13:51 |
See site module, especially site._get_path() # Same to sysconfig.get_path('purelib', os.name+'_user') def _get_path(userbase): version = sys.version_info if os.name == 'nt': return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages' if sys.platform == 'darwin' and sys._framework: return f'{userbase}/lib/python/site-packages' return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages' |
|
|
msg302361 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2017-09-17 08:05 |
Not sure about Windows. _get_path() looks to me is used for user site-packages. getsitepackages() doesn't do the same and seems matching the current message, also the OS2 branch in py2. Let's consult Windows guys. |
|
|
msg302480 - (view) |
Author: Steve Dower (steve.dower) *  |
Date: 2017-09-18 18:50 |
I don't have time right this second to write it all up, but I did so in the past at https://docs.python.org/3/using/windows.html#finding-modules Hopefully the answer you need is somewhere in that. Module search paths are complicated (but eric.snow is going to make it possible to use Python code to derive the search path at startup... right Eric? Right? :) ) |
|
|
msg307127 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2017-11-28 15:16 |
New changeset 08d2b86a1058b733bb7f1ae2b55818dd9687d21c by Christian Heimes (gauravbackback) in branch 'master': bpo-31440: Changed default module search path for windows https://github.com/python/cpython/commit/08d2b86a1058b733bb7f1ae2b55818dd9687d21c |
|
|
msg307132 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-11-28 15:45 |
I confirm that Python 2.7 is affected and should also be fixed. |
|
|
msg307147 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2017-11-28 17:18 |
I'll do a backport tomorrow. |
|
|
msg307148 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2017-11-28 17:18 |
New changeset cb79c2203953bd465f2c53b7a09a51071717575f by Christian Heimes (Miss Islington (bot)) in branch '3.6': bpo-31440: Changed default module search path for windows (#4613) https://github.com/python/cpython/commit/cb79c2203953bd465f2c53b7a09a51071717575f |
|
|