Resolving deltas: 100% (2388/2388), done. Checking connectivity. We have behave's setup.py in /tmp/behave: (test_env) $ ls /tmp/behave/setup.py /tmp/behave/setup.py. Install the python package from the git repo (test_env) $ cd /tmp/behave && python setup.py install running install. As noted in this SO post, you will have to reset its hash of modules after installing (certain?) new ones. You likely don't need to worry about this yet. If you don't use ipython, and you haven't tried it, it might be worth checking out. It's a lot better than the basic Python shell, or pretty much any other REPL I've.
Here’s a simple python script to list all installed python modules: python -c 'help('modules')' Only problem is that when I run this I see: Please wait a moment while I gather a list of all available modules. Fatal Python error: Interpreter not initialized (version mismatch?) Abort trap This error message is not helpful because it does not tell me which Python module caused the error.
So, to determine which module is actually compiled with the wrong python version I run this command with the verbose flag instead: python -vc 'help('modules')' Tags:, This entry was posted on Thursday, March 11th, 2010 at 10:10 pm and is filed under. You can follow any responses to this entry through the feed. You can, or from your own site. 3 Responses to “List all installed python modules (or determine bad module versions)”.
The main strength of the Python is, the wide range of external libraries are available. As we keep coding in Python, we install many packages. It is easy getting a Python list installed modules on the system. There are a couple of ways you can do that. Following are the two ways that will work for you to get this list #1 Using help function (without pip): The simplest way is to open Python console and type the following command help('modules') This will gives you a list of the installed module on the system. This list contains packages that come pre-installed with Python and some are installed explicitly.
You don’t need to install any external module to get this list with help function. But this command does not give you any other information about the package. If you want to know the version of each installed modules, you can use pip program. #2 Using pip to find Python list installed modules and their Versions: To find the list of Python packages installed on the system, you can use pip program. Those who don’t know about pip, it is a program which is used to install other Python packages on the system. You can and install it.
Run following commands on the command line (not on Python console). You get the complete list of installed Python modules with their versions. Pip freeze or pip list Note: Before running this command, ensure if there is a pip installed on your system. For Python version 2.7+ and 3.4+, it comes pre-installed with Python. The format of the output list of both commands is totally different. Suppose you are using these command in shell scripting. You can choose any of the commands which you find easy for parsing the output package list and get the information.
If you already have parsing code for any of the output from two commands, you can use that command. Related Read: (Python vs Shell Scripting) For more detail about any specific module, run command.
Pip show getopt It returns the name of the module/package, version, author, author email, license, location of the installed module and requires. You can get an email of the author. You can reach out to the author for any specific query related to the Python package. If you are using python code for commercial purpose, kowing package’s license is important. How to check if Python module is installed? You can use pip commands with grep command to search for any specific module installed on your system.
Pip list grep getopt For an instance, you can also list out all installed modules with the suffix “re” in the module name. Pip list grep re How to count number of Python modules installed on your system? You can use wc (word count) command. Pip list wc -l Note: grep and wc commands only work with Linux based systems. What is the use of these commands?.
You can use these commands to list out all the installed modules on your system. Later you can use this list to set up a new identical environment. If you face any issue in installed Python package, running these commands make debugging easier. Knowing Python module version, you can update module if a new version of the module is available. In an upcoming article, I will share, how you can write Python program to get a list of Python packages and save them in a list.
If you find these commands useful for Python list installed modules, share with your friends. Feel free to write a comment if you have any question regarding handling Python packages. Be calm and start learning!