Question

I can find the module https://pypi.python.org/pypi/DateTime

But I don't know the command to install via easy_install. I'm getting a no module named datetime error and so I need to get this installed.

Was it helpful?

Solution 2

Module names are case sensitive. easy_install DateTime works for me:

enter image description here

OTHER TIPS

The package, like the module, is named DateTime, not datetime. datetime is a different module, which is already part of Python's standard library.

When I do this, it works:

$ sudo easy_install-2.7 DateTime

Because easy_install is a big collection of PyPI-scraping hacks designed to make your life easier rather than an interface to a well-defined API, sometimes you can get away with getting the case wrong, or even leaving bits off, and it'll figure out what you mean and install the right thing. But you should not rely on this, because sometimes you can't get away with it.

Of course you really should be using pip instead of easy_install.

And you probably shouldn't be using this module at all. Notice that it says right at the top "Unless you need to communicate with Zope 2 APIs, you're probably better off using Python's built-in datetime module". And the fact that your error is no module named datetime implies pretty strongly that your code is trying to use datetime, not DateTime, so installing this won't help you.

If you are on Mac:

In order to install the DateTime library you have to install 'pip' first (see Official instructions on How to install pip)

Then you can install DateTime library running this command on Terminal:

pip install DateTime

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top