Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bingefeller

macrumors 6502a
Original poster
Jun 25, 2007
605
38
Northern Ireland
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.
 
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.)
 
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.)

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.
 
Isn't it easy to mess something up via the command line though?

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.