刚开始学习python的时候使用的ipython解释器,挺好用的,后来发现bpython功能更强大,linux系统中安装基本没啥问题,不过在windows下安装倒是不容易啊。使用google搜了一下, 发现bpython-curses这个命令可以运行,参考了这个网址的https://github.com/bpython/bpython/issues/509官方对window安装的说明:https://docs.bpython-interpreter.org/windows.html
下面我整理下正确的安装方法。
1.先安装bpython
C:\Users\Administrator>pip install bpython #请确认你的pip已经安装并且配置到环境变量path中去了。 这里pip可以换成easy_install, conda
2.测试下bpython,提示No module named ‘_curses‘
C:\Users\Administrator>bpython Traceback (most recent call last): File "e:\program files\python36\lib\runpy.py", line 193, in _run_module_as_mai n "__main__", mod_spec) File "e:\program files\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:\Program Files\Python36\Scripts\bpython.exe\__main__.py", line 5, in < module> File "e:\program files\python36\lib\site-packages\bpython\curtsies.py", line 9 , in <module> import curtsies File "e:\program files\python36\lib\site-packages\curtsies\__init__.py", line 4, in <module> from .window import FullscreenWindow, CursorAwareWindow File "e:\program files\python36\lib\site-packages\curtsies\window.py", line 11 , in <module> import blessings File "e:\program files\python36\lib\site-packages\blessings\__init__.py", line 5, in <module> import curses File "e:\program files\python36\lib\curses\__init__.py", line 13, in <module> from _curses import * ModuleNotFoundError: No module named ‘_curses‘
3.安装cursers包
#去这个网站找到对应版本的curses下载下来,http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses ,这个包暂时pip没法去下载它,需要手工下载后再使用pip 安装 C:\Users\Administrator>pip install E:\tmp\curses-2.2-cp36-cp36m-win_amd64.whl
4.测试bpython,提示 No module named ‘fcntl‘
C:\Users\Administrator>bpython Traceback (most recent call last): File "e:\program files\python36\lib\runpy.py", line 193, in _run_module_as_mai n "__main__", mod_spec) File "e:\program files\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:\Program Files\Python36\Scripts\bpython.exe\__main__.py", line 5, in < module> File "e:\program files\python36\lib\site-packages\bpython\curtsies.py", line 9 , in <module> import curtsies File "e:\program files\python36\lib\site-packages\curtsies\__init__.py", line 4, in <module> from .window import FullscreenWindow, CursorAwareWindow File "e:\program files\python36\lib\site-packages\curtsies\window.py", line 11 , in <module> import blessings File "e:\program files\python36\lib\site-packages\blessings\__init__.py", line 7, in <module> from fcntl import ioctl ModuleNotFoundError: No module named ‘fcntl‘
5.修改启动bpython的位置
我的bpyton的安装位置是在E:\Program Files\Python36\Scripts ,我们不启动bpython 启动bpython-curses试试。
C:\Users\Administrator>bpython-curses #可以运行了。
6.命令重命名下
进入我们的E:\Program Files\Python36\Scripts目录,把bpython.exe,bpython-curses.exe先备份一下,然后删除bpython.exe, 修改bpython-curses.exe 为bpython.exe
7.在测试下吧,如果不可以,你先关闭终端,重新打开一下试试。
可以愉快的使用bpython了。
时间: 2024-11-05 12:34:18