Check if Python Package is installed -


What is a good way to check whether the package is installed inside a Python script? I know that this is easy with an interpreter, but I have to do this in a script.

I think I can check whether there is a directory on the system during installation, but I think that is a better way. I'm trying to make sure that the Skype4Py package is installed, and if I do not install it.

My thoughts to complete the check

  • Specific install path
  • Try importing the package and if an exception is thrown, the package If you want a dragon script, just do something like this:

/ P>

  Try: Import myrmile except importError, E: pass # module, deal with it  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -