Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if numpy is installed

Tags:

python

numpy

I'm writing Python code. I want to check if numpy and wxpython are installed on machine. How to do that??

like image 699
Netro Avatar asked Feb 16 '11 12:02

Netro


People also ask

How do I know if numpy is installed in CMD?

The first way to check if numpy is installed is to start an interactive Python session. You do this by opening up a command prompt/terminal, typing python , and pressing 'Enter'. You should now see something that shows information about the Python distribution you are using, followed by three greater-than signs.

Is numpy installed with Python?

The only prerequisite for installing NumPy is Python itself. If you don't have Python yet and want the simplest way to get started, we recommend you use the Anaconda Distribution - it includes Python, NumPy, and many other commonly used packages for scientific computing and data science.

Is numpy installed by default?

NumPy Installation On Windows Operating SystemPython is not installed by default in windows operating system.


1 Answers

You can try importing them and then handle the ImportError if the module doesn't exist.

try:     import numpy except ImportError:     print "numpy is not installed" 
like image 68
shang Avatar answered Sep 19 '22 18:09

shang