Tzu-ping Chung <uranu...@gmail.com> added the comment: > Surely "on native Windows you run venv-path\Scripts\activate[.ps1], on POSIX > you use source venv-path/bin/activate" isn't *that* hard for new users to > grok [...]?
The if-Windows-X-else-Y part isn’t that hard; it’s the activate part that is :p I think Brett is thinking about eliminating the manual activate part entirely, but any tool trying to automate that needs to do a lot of platform-specific checks. --- > I've personally never come across Scripts in any other situation than virtual > environments [...]. Windows use a Scripts directory to store… scripts (Setuptools terminology, i.e. console and gui script entry points). So e.g. the global pip.exe would be at "{sys.prefix}\Scripts\pip.exe" (or is it sys.exec_prefix?) `pip install --user` would also install scripts into `%APPDATA%\Programs\Python\PythonXY\Scripts`. So venv’s setup is consistent with the rest of Python. This directory structure can be expanded from sysconfig. So the proposal in my previous comment is to record the scheme in pyvenv.cfg, so you can have something like def read_venv_scheme(env_dir): with open(os.path.join(env_dir, 'pyvenv.cfg')) as f: for line in f: key, value = (p.strip() for p in line.split('=')) if key == 'scheme': return value def get_venv_environ_patch(env_dir): scheme = read_venv_scheme(env_dir) bin_dir = sysconfig.get_path('scripts', scheme=scheme, expand=False).format(base=env_dir) return {'VIRTUAL_ENV': env_dir, 'PATH': bin_dir} and this would give you the appropriate value on any platform. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35003> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com