-错误
ModuleNotFoundError: No module named 'xlwt'
-解决
excel$ pip install xlwt
bash: pip: command not found
excel$ sudo easy_install pip
=========================================================
python3.* 需要使用python3 来安装
excel$ pip install xlwt
excel$ pip install xlwtDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: xlwt in /Users/mingliang8/Library/Python/2.7/lib/python/site-packages (1.3.0)
excel$ pip3 install xlwt
Collecting xlwt
Using cached https://files.pythonhosted.org/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-none-any.whl
Installing collected packages: xlwt
Successfully installed xlwt-1.3.0
=========================================================
用xlwt模块执行代码报下面的错
ValueError: column index (256) not an int in range(256)
xlwt 模块看源码说最大列只支持255列,所以超过这个值就报错了,改用xlsxwriter模块
ImportError: No module named xlsxwriter
pip install xlsxwriter
或者
pip3 install xlsxwriter
=========================================================
网友评论