Python练习17-----pytz 模块的安装

来源:互联网 发布:ios8录屏软件 编辑:程序博客网 时间:2024/05/22 07:03

pyhon2.7没有时区模块pytz,如果要使用时区相关的函数,需要安装pytz,网上有很多easy_install的方法,本文采用最新的pip安装方法。

pip vs easy_install¶可以查看https://packaging.python.org/discussions/pip-vs-easy-install/#pip-vs-easy-install

easy_install was released in 2004, as part of setuptools. It was notable at the time for installing packages from PyPI using requirement specifiers, and automatically installing dependencies.

pip came later in 2008, as alternative to easy_install, although still largely built on top of setuptools components. It was notable at the time for not installing packages as Eggs or from Eggs (but rather simply as ‘flat’ packages from sdists), and introducing the idea of Requirements Files, which gave users the power to easily replicate environments.

好了,直接上安装pytz,
1、先安装PIP
On Linux or OS X:

    pip install -U pip setuptools

On Windows:

python -m pip install -U pip setuptools

2、安装pytz模块

python -m pip install pytz

3、安装截图如下

这里写图片描述

4、具体安装过程可参考官方文档:
https://packaging.python.org/tutorials/installing-packages/

5、代码验证安装结果:
这里写图片描述