Skip to content

Commit b9ba641

Browse files
authored
Merge pull request #769 from ftnext/feature/remove-distutils-init
Remove deprecated distutils.version from __init__.py
2 parents d188527 + 0d5f7da commit b9ba641

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ If not installed, everything in the library will still work, except attempting t
118118

119119
The installation instructions on the PyAudio website are quite good - for convenience, they are summarized below:
120120

121-
* On Windows, install PyAudio using `Pip <https://pip.readthedocs.org/>`__: execute ``pip install pyaudio`` in a terminal.
121+
* On Windows, install with PyAudio using `Pip <https://pip.readthedocs.org/>`__: execute ``pip install SpeechRecognition[audio]`` in a terminal.
122122
* On Debian-derived Linux distributions (like Ubuntu and Mint), install PyAudio using `APT <https://wiki.debian.org/Apt>`__: execute ``sudo apt-get install python-pyaudio python3-pyaudio`` in a terminal.
123-
* If the version in the repositories is too old, install the latest release using Pip: execute ``sudo apt-get install portaudio19-dev python-all-dev python3-all-dev && sudo pip install pyaudio`` (replace ``pip`` with ``pip3`` if using Python 3).
124-
* On OS X, install PortAudio using `Homebrew <http://brew.sh/>`__: ``brew install portaudio``. Then, install PyAudio using `Pip <https://pip.readthedocs.org/>`__: ``pip install pyaudio``.
125-
* On other POSIX-based systems, install the ``portaudio19-dev`` and ``python-all-dev`` (or ``python3-all-dev`` if using Python 3) packages (or their closest equivalents) using a package manager of your choice, and then install PyAudio using `Pip <https://pip.readthedocs.org/>`__: ``pip install pyaudio`` (replace ``pip`` with ``pip3`` if using Python 3).
123+
* If the version in the repositories is too old, install the latest release using Pip: execute ``sudo apt-get install portaudio19-dev python-all-dev python3-all-dev && sudo pip install SpeechRecognition[audio]`` (replace ``pip`` with ``pip3`` if using Python 3).
124+
* On OS X, install PortAudio using `Homebrew <http://brew.sh/>`__: ``brew install portaudio``. Then, install with PyAudio using `Pip <https://pip.readthedocs.org/>`__: ``pip install SpeechRecognition[audio]``.
125+
* On other POSIX-based systems, install the ``portaudio19-dev`` and ``python-all-dev`` (or ``python3-all-dev`` if using Python 3) packages (or their closest equivalents) using a package manager of your choice, and then install with PyAudio using `Pip <https://pip.readthedocs.org/>`__: ``pip install SpeechRecognition[audio]`` (replace ``pip`` with ``pip3`` if using Python 3).
126126

127127
PyAudio `wheel packages <https://pypi.python.org/pypi/wheel>`__ for common 64-bit Python versions on Windows and Linux are included for convenience, under the ``third-party/`` `directory <https://github.com/Uberi/speech_recognition/tree/master/third-party>`__ in the repository root. To install, simply run ``pip install wheel`` followed by ``pip install ./third-party/WHEEL_FILENAME`` (replace ``pip`` with ``pip3`` if using Python 3) in the repository `root directory <https://github.com/Uberi/speech_recognition>`__.
128128

reference/library-reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Speech Recognition Library Reference
66

77
Creates a new ``Microphone`` instance, which represents a physical microphone on the computer. Subclass of ``AudioSource``.
88

9-
This will throw an ``AttributeError`` if you don't have PyAudio 0.2.11 or later installed.
9+
This will throw an ``AttributeError`` if you don't have PyAudio (0.2.11 or later) installed.
1010

1111
If ``device_index`` is unspecified or ``None``, the default microphone is used as the audio source. Otherwise, ``device_index`` should be the index of the device to use for audio input.
1212

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ universal=1
77
dev =
88
flake8
99
rstcheck
10+
audio =
11+
PyAudio >= 0.2.11
1012
whisper-local =
1113
openai-whisper
1214
soundfile

speech_recognition/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Microphone(AudioSource):
5959
"""
6060
Creates a new ``Microphone`` instance, which represents a physical microphone on the computer. Subclass of ``AudioSource``.
6161
62-
This will throw an ``AttributeError`` if you don't have PyAudio 0.2.11 or later installed.
62+
This will throw an ``AttributeError`` if you don't have PyAudio (0.2.11 or later) installed.
6363
6464
If ``device_index`` is unspecified or ``None``, the default microphone is used as the audio source. Otherwise, ``device_index`` should be the index of the device to use for audio input.
6565
@@ -108,9 +108,6 @@ def get_pyaudio():
108108
import pyaudio
109109
except ImportError:
110110
raise AttributeError("Could not find PyAudio; check installation")
111-
from distutils.version import LooseVersion
112-
if LooseVersion(pyaudio.__version__) < LooseVersion("0.2.11"):
113-
raise AttributeError("PyAudio 0.2.11 or later is required (found version {})".format(pyaudio.__version__))
114111
return pyaudio
115112

116113
@staticmethod

0 commit comments

Comments
 (0)