Python import error dateutil

I try to execute marathon-lb.py and this causes the following error:

Traceback (most recent call last):
  File "./marathon_lb.py", line 46, in <module>
    import dateutil.parser
ImportError: No module named 'dateutil'

I just install python with apt and with pip. I launched:

sudo apt-get install python-pip
pip install python-dateutil

I will compile the script with: python -m py_compile script.py

Python app:

from operator import attrgetter
from shutil import move
from tempfile import mkstemp
from wsgiref.simple_server import make_server
from six.moves.urllib import parse
from itertools import cycle
from common import *
from config import *
from lrucache import *
from utils import *

import argparse
import json
import logging
import os
import os.path
import stat
import re
import requests
import shlex
import subprocess
import sys
import time
import dateutil.parser
+6
source share
2 answers

Install python-dateutil

pip install python-dateutil
+12
source

Step 1. Firstly, this is an update item for the corresponding version of Python (3 or 2).

pip3 install --upgrade pip

or

pip2 install --upgrade pip

Step2.

Sometimes a direct command does not work, as

Probably several versions are installed python-dateutil.

  1. Try to run pip uninstall python-dateutil

will display a message below if python-dateutilnot already installed.

Unable to remove python-dateutil requirement, not installed

  1. pip install python-dateutil.

. step2 , Python pip .

+1

All Articles