简体   繁体   中英

How to enable python interactive mode in cygwin?

I like python in interactive mode when on linux. However on cygwin, the interactive mode doesn't start. I don't see the ">>>" prompt and whatever I enter doesn't result in anything.

Solved : I figured out the problem from the answers below. I was using a windows installation of python and it needs -i option to start in interactive mode.

Try passing the -i flag to Python.

I've experienced this very same thing, as have others . There seems to be an issue with cygwin's ability to operate interactively with native-Windows applications (including Python.exe). If you can, install the cygwin version of Python via cygwin's package management, as it doesn't have this interactivity problem.

A Windows install of ActiveState python won't enter interactive mode, AND it will be run instead of cygwin Python even if you have cygwin Python installed, because ActiveState python inserts its bin path at the front of your Windows System PATH environment variables.

I solved it by going (in Windows) to Control Panel->System -> Advanced system settings-> Environment variables, choosing PATH, selecting Edit, and cut-pasting all the ActiveState entries from the front to the back of the PATH list.

I use it all the time.

$ python
Python ****** (********) 
**********************
Type "help", "copyright", "credits" or "license" for more information.
>>> "It works"
'It works'
>>> 

If you supply a file name, or anything like that, it won't go into interactive mode by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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