If you need to determine the
packages/modules/
libraries installed for
Python on a system, you can do so by obtaining a Python
command prompt and issuing the help("modules")
command.
$ python Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> help("modules") Please wait a moment while I gather a list of all available modules... 2018-08-18 15:31:45.666 Python[74959:5231860] Cannot find executable for CFBundle 0x 7fe335602be0 </System/Library/Frameworks/Message.framework> (not loaded) AVFoundation _TE dircache profile Accounts _Win dis pstats AddressBook __builtin__ distutils pty AppKit __future__ dl pwd AppleScriptKit _abcoll doctest py2app AppleScriptObjC _ast dumbdbm py_compile Audio_mac _bisect dummy_thread pyclbr Automator _builtinSuites dummy_threading pydoc BaseHTTPServer _codecs easy_install pydoc_data Bastion _codecs_cn email pyexpat CFNetwork _codecs_hk encodings pylab CFOpenDirectory _codecs_iso2022 ensurepip pyparsing CGIHTTPServer _codecs_jp errno pytz Canvas _codecs_kr exceptions quopri Carbon _codecs_tw fcntl random Cocoa _collections filecmp re CodeWarrior _csv fileinput readline Collaboration _ctypes findertools repr ColorPicker _ctypes_test fnmatch resource ConfigParser _curses formatter rexec Cookie _curses_panel fpformat rfc822 CoreData _elementtree fractions rlcompleter CoreFoundation _functools ftplib robotparser CoreGraphics _hashlib functools runpy CoreLocation _heapq future_builtins sched CoreText _hotshot gc scipy Dialog _io genericpath select DictionaryServices _json gensuitemodule sets DocXMLRPCServer _locale gestalt setuptools EasyDialogs _lsprof getopt sgmllib EventKit _markerlib getpass sha ExceptionHandling _multibytecodec gettext shelve Explorer _multiprocessing glob shlex FSEvents _osx_support grp shutil FileDialog _pyio gzip signal Finder _random hashlib site FixTk _scproxy heapq six Foundation _socket hmac smtpd FrameWork _sqlite3 hotshot smtplib HTMLParser _sre htmlentitydefs sndhdr IN _ssl htmllib socket InputMethodKit _strptime httplib sqlite3 InstallerPlugins _struct ic sre InstantMessage _symtable icglue sre_compile JavaScriptCore _sysconfigdata icopen sre_constants LatentSemanticMapping _testcapi idlelib sre_parse LaunchServices _threading_local ihooks ssl MacOS _tkinter imageop stat Message _warnings imaplib statvfs MimeWriter _weakref imghdr string MiniAEFrame _weakrefset imp stringold Nav abc importlib stringprep Netscape aepack imputil strop OSATerminology aetools inspect struct OpenDirectory aetypes io subprocess OpenSSL aifc itertools sunau PixMapWrapper altgraph json sunaudio PreferencePanes antigravity keyword symbol PubSub anydbm lib2to3 symtable PyObjCTools applesingle linecache sys PyPDF2 appletrawmain locale sysconfig QTKit appletrunner logging syslog Quartz argparse macerrors tabnanny Queue argvemulator macholib tarfile ScreenSaver array macostools telnetlib ScriptingBridge ast macpath tempfile ScrolledText asynchat macresource terminalcommand SearchKit asyncore macurl2path termios ServiceManagement atexit mailbox test SimpleDialog audiodev mailcap textwrap SimpleHTTPServer audioop markupbase this SimpleXMLRPCServer autoGIL marshal thread Social base64 math threading SocketServer bdb matplotlib time StdSuites bdist_mpkg md5 timeit StringIO bgenlocations mhlib tkColorChooser SyncServices binascii mimetools tkCommonDialog SystemConfiguration binhex mimetypes tkFileDialog SystemEvents bisect mimify tkFont Tix bonjour mmap tkMessageBox Tkconstants bsddb modulefinder tkSimpleDialog Tkdnd bsddb185 modulegraph toaiff Tkinter buildtools multifile token UserDict bundlebuilder multiprocessing tokenize UserList bz2 mutex trace UserString cPickle netrc traceback WebKit cProfile new ttk _AE cStringIO nis tty _AH calendar nntplib turtle _App cfmfile ntpath types _CF cgi nturl2path unicodedata _CG cgitb numbers unittest _CarbonEvt chunk numpy urllib _Cm cmath objc urllib2 _Ctl cmd olefile urlparse _Dlg code opcode user _Drag codecs operator uu _Evt codeop optparse uuid _File collections os videoreader _Fm colorsys os2emxpath warnings _Folder commands parser wave _Help compileall pdb weakref _IBCarbon compiler pickle webbrowser _Icn contextlib pickletools whichdb _LWPCookieJar cookielib pimp wsgiref _Launch copy pip xattr _List copy_reg pipes xdrlib _Menu crypt pkg_resources xlrd _Mlte csv pkgutil xml _MozillaCookieJar ctypes platform xmllib _OSA curses plistlib xmlrpclib _Qd datetime popen2 xxsubtype _Qdoffs dateutil poplib zipfile _Qt dbhash posix zipimport _Res dbm posixfile zlib _Scrap decimal posixpath zope _Snd difflib pprint Enter any module name to get more help. Or, type "modules spam" to search for modules whose descriptions contain the word "spam". >>> exit() $
Alternatively, if you have the
pip package manager installed, you can issue the command pip
list
at a command prompt. That method will also provide
the version number for the installed modules - see
pip for other command options.
$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --
format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under
the [list] section) to disable this warning.
altgraph (0.10.2)
bdist-mpkg (0.5.0)
bonjour-py (0.3)
macholib (1.5.1)
matplotlib (1.3.1)
modulegraph (0.10.4)
numpy (1.8.0rc1)
olefile (0.45.1)
pip (9.0.1)
py2app (0.7.3)
pyobjc-core (2.5.1)
pyobjc-framework-Accounts (2.5.1)
pyobjc-framework-AddressBook (2.5.1)
pyobjc-framework-AppleScriptKit (2.5.1)
pyobjc-framework-AppleScriptObjC (2.5.1)
pyobjc-framework-Automator (2.5.1)
pyobjc-framework-CFNetwork (2.5.1)
pyobjc-framework-Cocoa (2.5.1)
pyobjc-framework-Collaboration (2.5.1)
pyobjc-framework-CoreData (2.5.1)
pyobjc-framework-CoreLocation (2.5.1)
pyobjc-framework-CoreText (2.5.1)
pyobjc-framework-DictionaryServices (2.5.1)
pyobjc-framework-EventKit (2.5.1)
pyobjc-framework-ExceptionHandling (2.5.1)
pyobjc-framework-FSEvents (2.5.1)
pyobjc-framework-InputMethodKit (2.5.1)
pyobjc-framework-InstallerPlugins (2.5.1)
pyobjc-framework-InstantMessage (2.5.1)
pyobjc-framework-LatentSemanticMapping (2.5.1)
pyobjc-framework-LaunchServices (2.5.1)
pyobjc-framework-Message (2.5.1)
pyobjc-framework-OpenDirectory (2.5.1)
pyobjc-framework-PreferencePanes (2.5.1)
pyobjc-framework-PubSub (2.5.1)
pyobjc-framework-QTKit (2.5.1)
pyobjc-framework-Quartz (2.5.1)
pyobjc-framework-ScreenSaver (2.5.1)
pyobjc-framework-ScriptingBridge (2.5.1)
pyobjc-framework-SearchKit (2.5.1)
pyobjc-framework-ServiceManagement (2.5.1)
pyobjc-framework-Social (2.5.1)
pyobjc-framework-SyncServices (2.5.1)
pyobjc-framework-SystemConfiguration (2.5.1)
pyobjc-framework-WebKit (2.5.1)
pyOpenSSL (0.13.1)
pyparsing (2.0.1)
PyPDF2 (1.26.0)
python-dateutil (1.5)
pytz (2013.7)
scipy (0.13.0b1)
setuptools (1.1.6)
six (1.4.1)
xattr (0.6.4)
xlrd (1.0.0)
zope.interface (4.1.1)
$
You can also use pip freeze
, which outputs installed
packages in a slightly different "requirements format."
$ pip freeze altgraph==0.10.2 bdist-mpkg==0.5.0 bonjour-py==0.3 macholib==1.5.1 matplotlib==1.3.1 modulegraph==0.10.4 numpy==1.8.0rc1 olefile==0.45.1 py2app==0.7.3 pyobjc-core==2.5.1 pyobjc-framework-Accounts==2.5.1 pyobjc-framework-AddressBook==2.5.1 pyobjc-framework-AppleScriptKit==2.5.1 pyobjc-framework-AppleScriptObjC==2.5.1 pyobjc-framework-Automator==2.5.1 pyobjc-framework-CFNetwork==2.5.1 pyobjc-framework-Cocoa==2.5.1 pyobjc-framework-Collaboration==2.5.1 pyobjc-framework-CoreData==2.5.1 pyobjc-framework-CoreLocation==2.5.1 pyobjc-framework-CoreText==2.5.1 pyobjc-framework-DictionaryServices==2.5.1 pyobjc-framework-EventKit==2.5.1 pyobjc-framework-ExceptionHandling==2.5.1 pyobjc-framework-FSEvents==2.5.1 pyobjc-framework-InputMethodKit==2.5.1 pyobjc-framework-InstallerPlugins==2.5.1 pyobjc-framework-InstantMessage==2.5.1 pyobjc-framework-LatentSemanticMapping==2.5.1 pyobjc-framework-LaunchServices==2.5.1 pyobjc-framework-Message==2.5.1 pyobjc-framework-OpenDirectory==2.5.1 pyobjc-framework-PreferencePanes==2.5.1 pyobjc-framework-PubSub==2.5.1 pyobjc-framework-QTKit==2.5.1 pyobjc-framework-Quartz==2.5.1 pyobjc-framework-ScreenSaver==2.5.1 pyobjc-framework-ScriptingBridge==2.5.1 pyobjc-framework-SearchKit==2.5.1 pyobjc-framework-ServiceManagement==2.5.1 pyobjc-framework-Social==2.5.1 pyobjc-framework-SyncServices==2.5.1 pyobjc-framework-SystemConfiguration==2.5.1 pyobjc-framework-WebKit==2.5.1 pyOpenSSL==0.13.1 pyparsing==2.0.1 PyPDF2==1.26.0 python-dateutil==1.5 pytz==2013.7 scipy==0.13.0b1 six==1.4.1 xattr==0.6.4 xlrd==1.0.0 zope.interface==4.1.1 $
If you have Python installed on a
Linux or
Apple OS X system,
but not PIP, you
can install it using the easy_install utility with easy_install pip
.
If pip is installed, you will likely find it in the /usr/bin
directory. E.g., the below commands were run on an
OS X El
Capitan system on which I had installed pip:
$ which easy_install /usr/bin/easy_install $ which pip /usr/local/bin/pip $
Related articles: