14

I installed Python-Dateutil package, but when i import it in my script , it's throwing error:

import dateutil ImportError: No module named 'dateutil'

when i checked the lib folder, dateutil.eggs files are there , because of this i can not run matplotlib module. Please provide a solution.

Abhinaba
  • 161
  • 1
  • 2
  • 6
  • Whether or not you have some eggs is not important. Is the package installed? How did you install it? – ImportanceOfBeingErnest Dec 15 '17 at 13:56
  • I downloaded the source file and in command prompt gave the command as: "python setup.py install. " – Abhinaba Dec 15 '17 at 13:58
  • This is the prompt :-----C:\.................\Python\Python35-32\Scripts\dateutil-2.3>python setup.py install... please tell me if anything is wrong.@ImportanceOfBeingErnest – Abhinaba Dec 15 '17 at 14:08
  • That should be fine. Do you have a `Lib\site-packages\dateutil` folder? Usually you do not need to install it manually though, `pip install dateutil` or similar. – ImportanceOfBeingErnest Dec 15 '17 at 16:13
  • No I can't do that, because my system is running behind firewall. It can't download dateutil on its own. I have to install it manually. And no there is no dateutil folder inside the the path you given. Only .egg file of dateutil is there. if you want i can share the cmd prompt after the installation is done. – Abhinaba Dec 16 '17 at 09:11

4 Answers4

18

Python 3+

pip3 install python-dateutil

Python 2

pip install python-dateutil
Gayan Weerakutti
  • 11,904
  • 2
  • 71
  • 68
2

if you are using the anaconda

open anaconda prompt (go to start and search anaconda prompt)
type the following command on prompt

conda install -c anaconda dateutil

if you are using python 3.x version

pip3 install python-dateutil

if you are using python 2 version

pip2 install python-dateutil

Vishal
  • 33
  • 9
0

do you have multiple python version on your computer ? python 2.7 and 3.5 for example. maybe there is a confusion here.

or even multiple version of python 3.5 ?

i often have this problem when I forget which python I am using.

p.deman
  • 584
  • 2
  • 10
  • 24
  • Yes you are right . I have installed python 2.7.14 and 3.5 versions .So is there problem due to this ?? Should i uninstall other version and try to install dateutil again? – Abhinaba Dec 16 '17 at 09:06
  • 1
    there is no problem. just make sure that you are trying to import when running the same version of python that the one where you did the install – p.deman Dec 16 '17 at 12:21
-1

Installation dateutil

The dateutil module provides powerful extensions to the standard datetime module, available in Python.

  1. Install from PyPI using pip

    pip install python-dateutil

  2. Download from PyPI

    https://pypi.org/project/python-dateutil/

dataninsight
  • 1,069
  • 6
  • 13
  • If you read the original question properly, you would note that the poster has already detailed that they have installed the package. – BogeyMan Apr 13 '23 at 18:41