Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"-bash: python2: command not found" on OS X

Tags:

python

bash

macos

I'm trying to use this script to import my iTunes library to another program.

At the step where I enter python2 export_to_quod_libet.py, I'm getting an error message that says that the python2 command can't be found. I figured out through python -v that I definitely have Python 2.7 installed, so I'm really confused about this.

I did find a similar question being asked here, but the original poster was using Windows (whereas I'm using OS X El Capitan), so a lot of what was said at least didn't seem applicable to my situation.

Could someone tell me what I'm doing wrong, please?

like image 301
ForTheEvulz Avatar asked Jul 13 '16 06:07

ForTheEvulz


People also ask

How do I make Python 2.7 default on Mac?

Default MacOS System My current version is 2.7. 15. To change the default version on a MacOS, we can begin by downloading the newest installer from the Python downloads page (https://www.python.org/downloads/mac-osx/). Downloading the installer will insert the new version into /usr/local/bin.

How do I add Python to my path OSX?

Opening the Terminal and entering the command: sudo nano /etc/paths . Enter your password when prompted to do so. A list of directories that are currently a part of the PATH variable will appear. Enter the path of the Python install directory at the end of this list.


1 Answers

Maybe you could try do define an alias. It seems that python2 is hardcoded somewhere in the script.

You could try (just an example):

alias python2="python2.7"

and then run the script -- hope that helps.

Kind regards, Julian

like image 170
Julian Avatar answered Oct 02 '22 20:10

Julian