windows下安装Python的XlsxWriter模块方法


本文摘自php中文网,作者不言,侵删。

这篇文章主要介绍了关于windows下安装Python的XlsxWriter模块方法,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

在windows环境下安装python的XlsxWriter模块,虽然很简单,但由于自己粗心,少了一个字符,导致不少的错误。。。

1、通过pip命令来安装。

1

2

3

4

5

6

C:\Users\Administrator>pip install XlsWriter

Collecting XlsWriter

 Could not find a version that satisfies the requirement XlsWriter (from versions: )

No matching distribution found for XlsWriter

You are using pip version 7.1.2, however version 8.1.1 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command.

2、误以为是由于pip的版本太低,所以根据错误信息中的提示,更新pip

其中可以看到,会先下载,然后检测到有先前的版本,所以会先卸载,最后安装新版本的pip。

1

2

3

4

5

6

7

8

9

C:\Users\Administrator>python -m pip install --upgrade pip

Collecting pip

 Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)

 100% |████████████████████████████████| 1.2MB 61kB/s

Installing collected packages: pip

 Found existing installation: pip 7.1.2

 Uninstalling pip-7.1.2:

  Successfully uninstalled pip-7.1.2

Successfully installed pip-8.1.1

3、再次尝试安装,还是报错,觉得很奇怪,到底是什么地方错了,仔细看了一下,才发现是犯了低级错误鄙视,应该是 XlsxWriter 而不是XlsWriter,就是少了一个字符x导致报错:找不到要求安装的XlsWriter的一个版本。

1

2

3

4

C:\Users\Administrator>pip install XlsWriter

Collecting XlsWriter

 Could not find a version that satisfies the requirement XlsWriter (from versions: )

No matching distribution found for XlsWriter

4、这次总算下载成功,并安装了大笑。

1

2

3

4

5

6

C:\Users\Administrator>pip install XlsxWriter

Collecting XlsxWriter

 Downloading XlsxWriter-0.8.6-py2.py3-none-any.whl (134kB)

 100% |████████████████████████████████| 143kB 26kB/s

Installing collected packages: XlsxWriter

Successfully installed XlsxWriter-0.8.6

5、另一种方法是,通过eays_install来安装XlsxWriter模块。

1

2

3

4

5

6

7

8

C:\Users\Administrator>easy_install XlsxWriter

Searching for XlsxWriter

Best match: XlsxWriter 0.8.6

Adding XlsxWriter 0.8.6 to easy-install.pth file

  

Using c:\python27\lib\site-packages

Processing dependencies for XlsxWriter

Finished processing dependencies for XlsxWriter

6、接下来验证一下,是否安装成功。

这里打开cmd,输入python,这样就进入到python的交互环境。

最简单的方法就是 import 这个模块,如果没报错,就说明安装成功了。

这里特别要强调的是虽然上面的模块名称是XlsxWriter,但是在这里import时,都是小写的xlsxwriter,只要有一个字符不同,就会报错。

1

2

3

4

5

C:\Users\Administrator>python

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> import xlsxwriter

>>>

不得不说,安装python的各种模块,非常的方便,很赞大笑

关于XlsxWriter模块的详细参考信息可以查阅:https://xlsxwriter.readthedocs.io/

相关推荐:

使用python实现XlsxWriter创建Excel文件并编辑

对python中的xlsxwriter库简单分析


以上就是windows下安装Python的XlsxWriter模块方法的详细内容,更多文章请关注木庄网络博客!!

相关阅读 >>

Python中zip是什么函数

Python的调试;print()和断言(实例解析二)

Python可以开发什么

Python如何使用xlrd实现读取合并单元格

Python中format函数什么意思

关于Python函数的深度解剖

Python之爬取其他网页

Python使用matplotlib绘制3d图形(代码示例)

Python基本语句有哪些

Python怎么把列表转化为字符串

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...