python-dateutil

Python dateutils print recurrence rule according to iCalendar format (see RFC 5545)

浪子不回头ぞ 提交于 2019-11-27 18:06:23
问题 I am trying to print a recurrence rule as a string specified by iCalendar format (see RFC 5545). Im using python dateutils, in particular dateutil.rrule to create the recurrence rule and I want to print this as a string like: "RRULE:FREQ=DAILY;COUNT=5" Can anyone tell me if there is a method to achieve this? I think I'm using the labix dateutils btw. Many thanks! 回答1: There is no method or function in the python-dateutil package to do this. See this bug for a patch that may help: https://bugs

ImportError: matplotlib requires dateutil

故事扮演 提交于 2019-11-27 17:26:28
I have successfully installed matplotlib with python 2.6 on x64 Windows7. When I try to import matplotlib, it shows the following error. I have also installed numpy following this link: Installing Numpy on 64bit Windows 7 with Python 2.7.3 import matplotlib.pyplot as plt Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import matplotlib.pyplot as plt File "C:\Python26\Lib\site-packages\matplotlib\__init__.py", line 110, in <module> raise ImportError("matplotlib requires dateutil") ImportError: matplotlib requires dateutil How can I make it work? I installed matplotlib

python 2.7: cannot pip on windows “bash: pip: command not found”

二次信任 提交于 2019-11-27 12:36:07
I am trying to install the SciPy stack located at https://scipy.org/stackspec.html [I am only allowed 2 links; trying to use them wisely]. I realize that there are much easier ways to do this, but I think there is a lot to be learned by doing it manually. I am relatively new to a lot of this stuff, so I apologize if I sound ignorant at any point. I am running Windows 7 Enterprise - 64 bit . Here is what I have done so far: Installed python-2.7.8.msi (32-bit) from https://www.python.org/download/releases/2.7.8/ Installed numpy-1.8.1-win32-superpack-python2.7 from http://sourceforge.net/projects

How to install python-dateutil on Windows?

北慕城南 提交于 2019-11-27 01:44:20
问题 I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo classes. No problem, a quick search turns up python-dateutil which should do exactly what I need. The problem is that I need to install it on Windows. I was able to upack the .tar.gz2 distribution using 7-zip, but now I'm left with a collection of files and no guidance on how to proceed. When I

Timezone offset sign reversed by Python dateutil?

隐身守侯 提交于 2019-11-26 21:23:06
问题 Does anyone know why python's dateutil reverses the sign of the GMT offset when it parses the datetime field? Apparently this feature is a known outcome of not only dateutil but also other parsing functions. But this results in an INCORRECT datetime result unless a pre-processing hack is applied: from dateutil import parser jsDT = 'Fri Jan 02 2015 03:04:05.678910 GMT-0800' python_datetime = parser.parse(jsDT) print(python_datetime) >>> 2015-01-02 03:04:05.678910+08:00 jsDT = 'Fri Jan 02 2015

Matplotlib issue on OS X (“ImportError: cannot import name _thread”)

Deadly 提交于 2019-11-26 19:42:47
At some point in the last few days, Matplotlib stopped working for me on OS X. Here's the error I get when trying to import matplotlib : Traceback (most recent call last): File "/my/path/to/script/my_script.py", line 15, in <module> import matplotlib.pyplot as plt File "/Library/Python/2.7/site-packages/matplotlib/pyplot.py", line 34, in <module> from matplotlib.figure import Figure, figaspect File "/Library/Python/2.7/site-packages/matplotlib/figure.py", line 40, in <module> from matplotlib.axes import Axes, SubplotBase, subplot_class_factory File "/Library/Python/2.7/site-packages/matplotlib

Python datetime strptime() and strftime(): how to preserve the timezone information

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 19:28:00
问题 See the following code: import datetime import pytz fmt = '%Y-%m-%d %H:%M:%S %Z' d = datetime.datetime.now(pytz.timezone("America/New_York")) d_string = d.strftime(fmt) d2 = datetime.datetime.strptime(d_string, fmt) print d_string print d2.strftime(fmt) the output is 2013-02-07 17:42:31 EST 2013-02-07 17:42:31 The timezone information simply got lost in the translation. If I switch '%Z' to '%z', I get ValueError: 'z' is a bad directive in format '%Y-%m-%d %H:%M:%S %z' I know I can use python

python 2.7: cannot pip on windows “bash: pip: command not found”

北战南征 提交于 2019-11-26 16:04:49
问题 I am trying to install the SciPy stack located at https://scipy.org/stackspec.html [I am only allowed 2 links; trying to use them wisely]. I realize that there are much easier ways to do this, but I think there is a lot to be learned by doing it manually. I am relatively new to a lot of this stuff, so I apologize if I sound ignorant at any point. I am running Windows 7 Enterprise - 64 bit . Here is what I have done so far: Installed python-2.7.8.msi (32-bit) from https://www.python.org

Mac 安装jupyter notebook的过程

这一生的挚爱 提交于 2019-11-26 12:22:32
MAC台式机 python:mac下自带Python 2.7.10 1.先升级了pip安装工具:sudo python -m pip install --upgrade --force pip 2.安装setuptools 工具:sudo pip install setuptools==33.1.1 3.安装 Python-dateutil:sudo pip install python-dateutil==2.2 4.安装six:sudo pip install --ignore-installed six 5.安装jupyter:sudo install jupyter 启动命令:直接在终端输入jupyter notebook 折腾了半天,才搞好,以上命令是在安装的时候遇到各种问题时使用的,下面写记录一下遇到的问题 以及对应的解决办法 1.ImportError: cannot import name _thread 报这个错误 解决办法: sudo pip uninstall python-dateutil sudo pip install python-dateutil==2.2 2.File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in <module> from six

Matplotlib issue on OS X (“ImportError: cannot import name _thread”)

偶尔善良 提交于 2019-11-26 07:25:32
问题 At some point in the last few days, Matplotlib stopped working for me on OS X. Here\'s the error I get when trying to import matplotlib : Traceback (most recent call last): File \"/my/path/to/script/my_script.py\", line 15, in <module> import matplotlib.pyplot as plt File \"/Library/Python/2.7/site-packages/matplotlib/pyplot.py\", line 34, in <module> from matplotlib.figure import Figure, figaspect File \"/Library/Python/2.7/site-packages/matplotlib/figure.py\", line 40, in <module> from