如何获得Git Bash(在Windows上)以自动连接到"winpty python.exe"?在加载时? [英] How do I get Git Bash (on Windows) to automatically connect to "winpty python.exe" upon loading?
问题描述
我是新手,所以请不要为我表现出的任何文盲而嘲笑我或嘲笑我!
I'm a newbie, so no laughter at or mocking of me for any illiteracy I exhibit please!
我能够使Python在Git Bash中已经可以工作,但是要做到这一点,我每次打开Git Bash时都必须输入以下命令,然后才能进入交互模式.
I am able to get Python to work already in Git Bash, but to do so I have to input the following command every time I open Git Bash before I can enter interactive mode.
alias python='winpty python.exe'
每次我登录命令行时都必须执行此操作.如何确保Git Bash在登录后自动执行此功能?
It is tedious to have to do this every time I log into the command line. How do I ensure that Git Bash performs this function automatically upon logging on?
推荐答案
启动"Git Bash",然后执行如下所示的操作来修改用户的 .bashrc
:
Start "Git Bash" then execute something like the following to modify your user's .bashrc
:
$ echo 'alias python="winpty python.exe"' >> ~/.bashrc
然后退出"Git Bash"并重新启动.您会看到类似这样的内容:
Then exit "Git Bash" and start it again. You'll see something like this:
现在运行 alias
,您应该看到以下内容:
Now run alias
and you should see this:
$ alias
alias python ='winpy python.exe'
alias ll='ls -l'
alias ls='ls -F --color=auto --show-control-chars'
这篇关于如何获得Git Bash(在Windows上)以自动连接到"winpty python.exe"?在加载时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!