pip/pip3 install bpython
or
sudo apt install bpython
先安装bpython(如安装太慢, 可以考虑pip换源, 本人之前博客有些)
cmd/powershell运行bpyhon出现No module named '_curses'
安装cursers包
#去这个网站找到对应版本的curses下载下来,http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses ,这个包暂时pip没法去下载它,需要手工下载后再使用pip 安装
pip install ./curses-2.2-cp36-cp36m-win_amd64.whl
cmd/powershell运行bpyhon出现No module named 'fcntl'
不启动bpython 启动bpython-curses试试
如bpython-curses启动成功往下走
# 命令重命名
进入你的python安装路径类似c:\xxxxx\Python36\Scripts
bpython.exe,bpython-curses.exe先备份一下,然后删除bpython.exe, 修改bpython-curses.exe 为bpython.exe
然后运行bpython, 观察是否运行成功
然后在bpython里面运行python时可能出现
File "c:\users\xxx\python37\lib\site-packages\bpython\filelock.py", line 103, in release
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
ValueError: I/O operation on closed file
相似问题(别人是选择Visual Studio 2015 进行下载, 安装组件选择c++生成工具即可。)
我直接打开这个报错文件filelock.py, 修改其中报错位置103行
class WindowsFileLock(BaseLock):
"""Simple file locking for Windows using msvcrt
"""
def __init__(self, fileobj, mode=None):
super(WindowsFileLock, self).__init__(fileobj)
def acquire(self):
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_NBLCK, 1)
self.locked = True
def release(self):
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
self.locked = False
class WindowsFileLock(BaseLock):
"""Simple file locking for Windows using msvcrt
"""
def __init__(self, fileobj, mode=None):
super(WindowsFileLock, self).__init__(fileobj)
def acquire(self):
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_NBLCK, 1)
self.locked = True
def release(self):
# TODO:
try:
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
except Exception:
pass
finally:
self.locked = False
如果提示gpgcheck 那就pip install gpgpack