简体   繁体   English

OS X上的“-bash:python2:command not found”

[英]“-bash: python2: command not found” on OS X

I'm trying to use this script to import my iTunes library to another program. 我正在尝试使用脚本将我的iTunes资料库导入另一个程序。

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. 在我输入python2 export_to_quod_libet.py的步骤中,我收到一条错误消息,指出无法找到python2命令。 I figured out through python -v that I definitely have Python 2.7 installed, so I'm really confused about this. 我通过python -v想出我确实安装了Python 2.7,所以我对此非常困惑。

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. 我确实在这里发现了一个类似的问题 ,但原来的海报是使用Windows(而我使用的是OS X El Capitan),所以至少所说的很多内容似乎并不适用于我的情况。

Could someone tell me what I'm doing wrong, please? 有人能告诉我我做错了吗?

Maybe you could try do define an alias. 也许你可以尝试定义一个别名。 It seems that python2 is hardcoded somewhere in the script. 似乎python2在脚本中的某处硬编码。

You could try (just an example): 你可以尝试(只是一个例子):

alias python2="python2.7"

and then run the script -- hope that helps. 然后运行脚本 - 希望有所帮助。

Kind regards, Julian 亲切的问候,朱利安

I confirmed it works on macOS. 我确认它适用于macOS。 I installed Python 2.7 and 3.5 using brew commands: 我使用brew命令安装了Python 2.7和3.5:

brew update
brew install python
brew install python3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM