venv and executing other python programs
Martin Di Paola
martinp.dipaola at gmail.com
Thu Feb 17 06:44:36 EST 2022
>>
>> That's correct. I tried to be systematic in the analysis so I tested all
>> the possibilities.
>
>Your test results were unexpected for `python3 -m venv xxx`. By
>default, virtual environments exclude the system and user site
>packages. Including them should require the command-line argument
>`--system-site-packages`. I'd check sys.path in the environment. Maybe
>you have PYTHONPATH set.
Nope, I checked with "echo $PYTHONPATH" and nothing. I also checked
"sys.path" within and without the environment:
Inside the environment:
['', '/usr/lib/python37.zip', '/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/user/tmp/xxx/lib/python3.7/site-packages']
Outside the environment:
['', '/usr/lib/python37.zip', '/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/user/.local/lib/python3.7/site-packages',
'/usr/local/lib/python3.7/dist-packages',
'/usr/lib/python3/dist-packages']
Indeed the "sys.path" inside the environment does not include system's
site-packages.
I'll keep looking....
>A virtual environment is configured by a "pyvenv.cfg" file that's
>either beside the executable or one directory up. Activating an
>environment is a convenience, not a requirement.
Thanks, that makes a little more sense!
>--
>https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list