Unable to install logging module (Python) [duplicate]
Asked Answered
F

2

30

I'm trying to install the logging module for Python 3.4. I'm using pip3 install logging. Both times I run into a SyntaxError at line 618 of the __init__ method: "raise NotImplementedError, 'emit must be implemented '\".

Someone posted the same question as me, and solved their problem by deleting an interfering third party library called logging: Logging module not working with Python3.

But I have no such library already installed in my site-packages directory.

Felishafelita answered 16/10, 2015 at 16:42 Comment(1)
"I'm trying to install the logging module for Python 3.4. I'm using pip3 install logging... But I have no such library already installed in my site-packages directory." - ??? Just to make sure: you understood that the purpose of pip3 install is to put things in the site-packages directory? And that you could not possibly get a SyntaxError from this code if it weren't installed, since installing it is what makes it available to run? Therefore, you did, in fact, have it installed.Orts
A
74

logging is part of the Python standard library, and has been since version 2.3. It's available as soon as you install Python. You don't need to pip install anything...

Antidromic answered 16/10, 2015 at 17:20 Comment(2)
none of the standard libraries get installed when using virtualenv for python3. So how would one install logging into a virtualenv?Galangal
@Galangal of course they do. Python wouldn't function without the stdlib. The files may not be copied into your virtualenv from the system location, but they're still available for use.Antidromic
G
2

You don't need to install the logging module separately.

logging is a standard Python module, and it comes with the Python installation.

You just need to use import logging in your python code.

Geoff answered 23/2, 2023 at 14:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.