1) pip install daemon.
2) Open windows cmd and input: python, then input: import daemon the terminal show
>>> import daemon
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\daemon\__init__.py", line 42, in <module>
from .daemon import DaemonContext
File "C:\Python27\lib\site-packages\daemon\daemon.py", line 25, in <module>
import pwd
ImportError: No module named pwd
>>>
3) pip install pwd
what's the problem?????
The pwd module is a UNIX only package, it's for managing passwords.
The package you are trying to install is daemon, which is an un-maintained package from 2014. There is a more recent package called python-daemon, which is well maintained and used for implementing daemons in UNIX systems. It also works with python3. Though again, this will not work on windows.
If you're writing an application yourself and want to do this on windows you need to install it as a service, not a daemon this stackoverflow post is old, but still relevant.
python-daemon
(newer version) and daemon
both require the pwd
package, which is not available on Windows.
Your code should detect that this is not available and disable daemon mode on Windows (which isn't really a thing).
try:
import daemon
except ImportError:
daemon = None
Then later, you can check if daemon is None
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With