Mar-31-2023, 08:27 AM
Hi again!
As my knowledge is still very very limited, I learn mostly by imitating code and then later on, I expand it or manipulate it, till I get what I want.
Due to some trials and errors, I have added quite a few modules to python. I'd like to identify them by date of installation, and then to eliminate them to free space on my computer.
I tried some options that didn't work. Some others, I don't understand, as the commands are for Linux and they don't seem to work on Windows.
Finally, I found some code that seemingly works:
Did I make some mistake with the code?
Thanks for your help,
As my knowledge is still very very limited, I learn mostly by imitating code and then later on, I expand it or manipulate it, till I get what I want.
Due to some trials and errors, I have added quite a few modules to python. I'd like to identify them by date of installation, and then to eliminate them to free space on my computer.
I tried some options that didn't work. Some others, I don't understand, as the commands are for Linux and they don't seem to work on Windows.
Finally, I found some code that seemingly works:
import pkg_resources, os, time for package in pkg_resources.working_set: print("%s: %s" % (package, time.ctime(os.path.getctime(package.location))))but actually I think it doesn't, because ALL modules are shown with the same date and time, as you can see on this excerpt:
[...] PyYAML 6.0: Tue Feb 7 01:43:59 2023 PyQt5 5.15.7: Tue Feb 7 01:43:59 2023 PyQtWebEngine 5.15.4: Tue Feb 7 01:43:59 2023 isort 5.9.3: Tue Feb 7 01:43:59 2023 psutil 5.9.0: Tue Feb 7 01:43:59 2023 traitlets 5.7.1: Tue Feb 7 01:43:59 2023 [...]I also find it strange that the list is not alphabetically ordered, neither it is by date, as all modules are shown with the exact same date and time.
Did I make some mistake with the code?
Thanks for your help,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs