osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

site package does not work


I am trying to dynamically add a site-package to a script that is run as a cron job. The method adduseristepackages does not seem to do anything.

import sys
import site

print('-------------------------')print(site.getusersitepackages())
print('add', site.addusersitepackages('/home/erik/.local/lib/python3.6/site-packages'))
print(site.getusersitepackages())
print(site.getsitepackages())
print(site.check_enableusersite())


output:-------------------------
/root/.local/lib/python3.6/site-packages
add /home/erik/.local/lib/python3.6/site-packages
/root/.local/lib/python3.6/site-packages
['/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages']
True


Thanks,
Erik