Windows7: pip install bpython ,'ImportError: No module named fcntl'錯誤解決

問題 1

pip install bpython 在Mac安裝沒有什麼問題, 一旦到了Windows就出現報錯:

    from fcntl import ioctl
ImportError: No module named fcntl

解決:

新建一個: fcntl.py文件, 將其存放Python的安裝目錄: C:\Python27\Lib 下.

該文件裏面代碼爲:

def fcntl(fd, op, arg=0):
    return 0

def ioctl(fd, op, arg=0, mutable_flag=True):
    if mutable_flag:
        return 0
    else:
        return ""

def flock(fd, op):
    return

def lockf(fd, operation, length=0, start=0, whence=0):
    return

想知道原理, 請看: Stackflow

文件放到指定位置後, 重新調用 bpython, 如果沒有報錯,祝賀運氣不錯. 如果出現了問題下面的衍生問題2 ……

衍生問題 2:

解決問題1, 接着出來了問題2.

     from termios import TIOCGWINSZ
ImportError: No module named termios

沒有解決這個問題, 好吧. 只好先用Ipython, 然後:

pip uninstall bpython

這個坑先記着.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章