How to list installed Python packages?

Discussion in 'Mac Programming' started by bingefeller, Feb 15, 2015.

  1. bingefeller macrumors 6502

    Joined:
    Jun 25, 2007
    Location:
    Northern Ireland
    #1
    Hi guys,

    What is the command to list the installed Python packages on my machine?

    I installed Python 2.7.9 via Homebrew but I know that I have other versions on my machine. I just wanted to check and see which one is active. I thought the command was python -list or python --list but these aren't working. Any help is appreciated.
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    find / -name python

    will list everything on your computer named Python.

    which python

    Will tell you which one appears first on your PATH (and so the one that will be used if you don't specify the full path.)

    These are both bash commands, and they're both off the top of my head so I might be wrong.

    You can also find out the path to the Python executable from within Python... I think one of the attributes of sys or os has it.

    A final thought - I hate brew and port and all those other Mac executable managers. The fact that they fight with each other and none of them are actually particulary good - bleh. Just manually install Python from python.org. I don't mind package managers in most Linux distros. Love yum. Love pip within Python (kind of sometimes. Can be irritating when a package I want to use isn't in PyPI and I have to find the obscure set of parameters to make it install from another source.)
     
  3. bingefeller thread starter macrumors 6502

    Joined:
    Jun 25, 2007
    Location:
    Northern Ireland
    #3
    Thanks for the info. I found what I was looking for.

    I use the package managers because they are apparently easier. To be honest, I am not good with the command line and I was recommended to use brew by others because of this.
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    You won't get better by not using it. I would recommend getting more comfortable with it.
     
  5. bingefeller thread starter macrumors 6502

    Joined:
    Jun 25, 2007
    Location:
    Northern Ireland
    #5
    Isn't it easy to mess something up via the command line though?
     
  6. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    Don't do

    sudo rm -rF /

    That's, use the admin account to delete everything starting at the root, recursively, and don't ask for further confirmation.

    In general, you should run

    man <command>

    to see what a new command does before you run it (man = manual. Tells you what a command does and shows what different parameters and flags you can pass in.)

    Anyways, you could do equally dangerous stuff writing programs... Probably worse.
     

Share This Page