Sujet : Re: Correct module for site customization of path
De : thjmmj15 (at) *nospam* gmail.com (Tim Johnson)
Groupes : comp.lang.pythonDate : 02. Nov 2024, 01:50:12
Autres entêtes
Message-ID : <mailman.73.1730508617.4695.python-list@python.org>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 11/1/24 08:32,
dieter.maurer@online.de wrote:
...
After the recent upgrades I had to install youtube_dl with pipx for the
new python version.
When I ran the script which imported youtube_dl, I got an import error
as it appears the path to the module
was not in sys.path....
I see at several options:
>
* install `youtoube_dl` where Python looks for it
(you can print `sys.path` to find out all the places
normally checked for importable modules)
>
* put a (symbolic) link to `youtoube_dl` at a place
where Python looks for modules
>
* use Pythons' `.pth' feature to tell Python additional
places where to look for modules.
You can place `.pth` files where Python looks for modules
to be imported
In /usr/lib/python3.12/sitecustomize.py I put the following:
import sys
sys.path.append("path to youtube_dl")
# In /usr/lib/python3.12/sitecustomize.py
# Thanks seems to work for me
cheers
-- Timthjmmj15@gmail.com