为什么 python 2.7.10 不能识别我的 .pystartup 和 .inputrc?

Why doesn't python 2.7.10 recognize my .pystartup and .inputrc?

为我的 ~/.pystartup 关注 this,并将 export PYTHONSTARTUP="~/.pystartup" 添加到我的 .bash_profile。在我打开一个新终端并启动 python 后,我得到

Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
IOError: [Errno 2] No such file or directory: '~/.pystartup'

~/pystarup 确实存在。我也想要 vi 键绑定,当我将 set editing-mode vi 放入我的 ~/.inputrc 时,我仍然没有得到适当的绑定。

我正在开发 OSX 10.10.5。我该如何解决这些问题?

由于我的评论对 OP 有所帮助,我将其复制到此处:Python 似乎无法识别 shell 特定功能,例如 ~ 已替换为主目录, 因此在这种情况下,最好手动将 ~ 替换为主目录的完整路径。

谈到.inputrc问题:Mac OS甚至没有使用它。相反,您应该使用 ~/.editrc。因此,您可以 运行 man editor 获取更多信息。有关此主题的更多信息,请参阅 this SO answer