4

How do you test if the version of python that comes pre-installed on your machine (in this case, Mac Lion) was compiled with support for threading?

Here's my info:

[16:31 7] uname -a
Darwin leopard.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 i386
[16:31 8] which python
/usr/bin/python
[16:31 9] python --version
Python 2.7.1
RBR
  • 999
  • 3
  • 13
  • 24
  • 1
    What do you mean by "support for threading"? How about entering "import threading" at a python command line? – TJD Jun 18 '12 at 23:52
  • 2
    I was reading the document for installing mod_wsgi and its python requirement was (quote): "The version of Python being used must have been compiled with support for threading." – RBR Jun 18 '12 at 23:58
  • 1
    Here's the document I was talking about above: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide – RBR Jun 19 '12 at 00:05
  • 1
    if "import threading" works you have support for threading. Also, possible duplicate: http://stackoverflow.com/questions/9193773/is-there-a-way-to-tell-if-python-was-configured-and-compiled-with-with-thread – pycoder112358 Jun 19 '12 at 00:09
  • Thank you, TJD and pycoder112358. Please let me give you credit for answering the question. – RBR Jun 19 '12 at 00:22

1 Answers1

1

Per the comments by TJD and pycoder112358, you can test if your Python installation has support for threading by running:

import threading

at the Python command line. If the threading module is not installed, this command will raise an exception:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import threading
ImportError: No module named threading
Community
  • 1
  • 1
Ricardo Altamirano
  • 14,650
  • 21
  • 72
  • 105