Can't find winsound module

Hi, I tried to import winsound module with pip but it tells me:
Error: Could not find a version that satisfies the requirement winsound (from version:none).
I can’t find it in PyCharm too.
Can someone help me please?
I use Python ver. 3.10.8

First, a bit of terminology which may be at the source of your issue. With pip you do not import a package, that is done with the import statement. Pip installs missing dependencies, thus pip install python-dateutil.

The winsound package is part of the standard library:winsound — Sound-playing interface for Windows — Python 3.10.8 documentation. You don’t have to install it using pip, it should come with the windows version of Python. You can immediately import it in your sources.

Dear @Mholscher thanks for your reply. Sorry for my lexicon but I’m a beginner. So is it for this reason that I can’t find it in PyCharm setting? And with Pyrhon 3.10.8 is it sufficient to import winsound in my script?

No need to apologise.

Indeed.

I wouldn’t know, I do not use PyCharm.

Check if you can import it outside of PyCharm. Launch a Python REPL on the command line, and try import winsound there. If it imports OK, then you have a PyCharm problem. If it doesn’t, there is probably something wrong with your Python installation.

Thanks @abessman . Can you please tell me the single step? I’m a beginner in Python… What do you mean for example to import external of PyCharm? Thanks

Start Python interpreter in interactive mode (REPL) and try to run the import statement there.

On Windows - success:

> py
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import winsound
>>>

:exclamation: Note that on Windows depending on the way of installation you run Python using one of these commands:
python3, python, py.

On Linux - failure (there is no such module there):

$ python3
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import winsound
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'winsound'
>>>
3 Likes

Perfect @vbrozik @Mholscher now it runs!!

Hello Denis_DS,
could you run winsound on Mac?
I have same issue :
ModuleNotFoundError: No module named ‘winsound’
I have Mac operating system.

[quote=“Feras1alfarsi, post:9, topic:20110, username:feras1alfarsi”]

I have same issue :
ModuleNotFoundError: No module named ‘winsound’
I have Mac operating system.
Is there a solution?
Thank you!

i meet a similar question, can u solove?

winsound is for Windows only. It says so in the docs.

thank your reply.
if use mac , can use following code

import time
import os

def countdown(seconds):
    while seconds > 0:
        os.system(f"say --voice=\"Ting-Ting\" {seconds}秒")
        print(f"倒计时: {seconds} 秒")
        time.sleep(1)
        seconds -= 1
    print("时间到!")
    os.system(f"say --voice=\"Ting-Ting\" 时间到")
countdown(10)