Install PyDev package or any other regular package during runtime in the python project
user2301
mythri.mroy at gmail.com
Wed Jan 31 07:00:03 EST 2018
I am trying to dynamically install PyDev package at runtime. I have a PyDev project created in eclipse. I have a PyDev package on network location. Based on some configuration and input in my PyDev project, I want to install and load the PyDev package from network location. The classes contained in modules within this package will be used later. How can I install the regular(PyDev package) at runtime?. Is it possible to install the package at runtime? To which location I have to add this package ? project root directory or sys.path?
What I had done: I had created the PyDev package inside my project root directory. Then import the module in the package dynamically.
from pydoc import locate
#package already created/installed within the project root
def load(self):
myclass = locate('package.module.classname') #importing module dynamically
instance = myclass()
what I need to do:
from pydoc import locate
#package not yet installed within the project root
def load(self):
# install the module first from given network path? how?
myclass = locate('package.module.classname') #importing module
dynamically
instance = myclass()
More information about the Python-list
mailing list