0

No code with this question because I've got no idea how to do this. Basically would like to check if a python package has already been installed using C#. The input is the url for the package ex: https://pypi.python.org/packages/2.7/n/numpy/numpy-1.7.1.win32-py2.7.exe. The program should check if the package has been installed already. Code, methods of doing this, anything is very appreciated. Thanks!

Mr Boss
  • 472
  • 4
  • 13
  • 2
    Quick thought. Could you run (from C#, not sure myself how to do it) `python -c "import numpy" and check it's exit code? – spalac24 Nov 13 '14 at 18:32
  • @user3267581 That is a pretty cool idea. Just keep in mind that the command would return a failure exit code if python wasn't installed too. – gcarvelli Nov 13 '14 at 18:34
  • Not a bad idea, will try this and let you know if I figure it out. Thanks :) – Mr Boss Nov 13 '14 at 18:38

1 Answers1

0

What operating system you are running? If its in Linux, you can call a shellscript that will execute a Python file. Within the file you can have a import statement that will import the package..

user1050619
  • 19,822
  • 85
  • 237
  • 413