Linux MintでPython3エラー「Bluetoothというモジュールがありません」

Linux MintでPython3エラー「Bluetoothというモジュールがありません」

Bluetooth経由でLenovo S10EをNintendo Wiimoteに接続しようとしています。私は以下のように単純なPythonスクリプトを使用しています。 Linux Mint(バージョン16、「Petra」)コマンドラインから呼び出します。python3 find_wii.py

私の目標は、WiimoteをMintに接続してから(最終的に)MIDIを出力することです。私はクロスプラットフォームの利点のためにPythonを使用しています。

スクリプト:

import bluetooth

target_name = "Nintendo RVL-CNT-01"
target_address = "00:1C:BE:29:75:7F"

nearby_devices = bluetooth.discover_devices()

for bdaddr in nearby_devices:
    if target_name == bluetooth.lookup_name( bdaddr ):
        target_address = bdaddr
        break

if target_address is not None:
    print("found target bluetooth device with address "), target_address
else:
    print("could not find target bluetooth device nearby")

エラーが発生しました。

Traceback (most recent call last):
  File "find_wii.py", line 1, in <module>
    import bluetooth
ImportError: No module named 'bluetooth'

これを行うには、bluezとpythonラッパー()をインストールしましたsudo aptitude install python-bluez。私のシステム(sudo apt-get update、)をアップグレードしましたsudo apt-get upgrade。 Googleに連絡しましたが、私が見つけることができる唯一の公式エラーは次のとおりです。ここそしてここ、どちらの答えも私には適していません。

BluetoothモジュールをMintで使用するにはどうすればよいですか?

[注:質問クロスパブリッシュスタックオーバーフロー]

ベストアンサー1

Bluetoothモジュールはpython2では利用できますが、まだpython3では利用できないと思います。 python2を使ってモジュールをロードしてみてください。

おすすめ記事