安装强大的python交互终端----bpython

安装强大的python交互终端----bpython

linux

pip/pip3 install bpython
or
sudo apt install bpython

windows

先安装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

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值