正在关注 this对于我的 ~/.pystartup 并将 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 键绑定(bind),当我将 set editing-mode vi
放入我的 ~/.inputrc 时,我仍然没有得到适当的绑定(bind)。
我正在使用 OSX 10.10.5。我该如何解决这些问题?
最佳答案
由于我的评论对 OP 有帮助,我将其复制到这里:Python 似乎无法识别 shell 特定的功能,如 ~
替换为主目录,因此最好手动替换~
在本例中为主目录的完整路径。
关于 .inputrc
的问题:Mac OS 甚至不使用它。相反,您应该使用您的 ~/.editrc
。因此,您可以运行 man editor
来获取更多信息。参见 this SO answer有关此主题的更多信息。
关于python - 为什么 python 2.7.10 不能识别我的 .pystartup 和 .inputrc?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34239218/