简体   繁体   English

Python ImportError:没有名为pybluez的模块

[英]Python ImportError: No module named pybluez

I am starting with python recently and I am trying to get the hang of the modules and libraries. 我最近开始使用python,并且尝试使这些模块和库挂起。 So I have one script which has the following line 所以我有一个脚本,其中包含以下行

from pybluez import bluetooth 

So I looked for this library and downloaded from here https://github.com/karulis/pybluez and then tried to install it using this instructions http://www.instructables.com/id/How-to-install-Python-packages-on-Windows-7/ 因此,我寻找了该库,并从这里https://github.com/karulis/pybluez下载了该库,然后尝试使用此说明http://www.instructables.com/id/How-to-install-Python-进行安装包上,Windows的7 /

A friend of mine also suggested for me to copy the file of pybluez to C:\\Users\\Python27\\Lib and I did it. 我的一个朋友还建议我将pybluez的文件复制到C:\\ Users \\ Python27 \\ Lib,然后我做到了。

And in the end I am still getting this error when I run that script: 最后,当我运行该脚本时,仍然出现此错误:

ImportError: No module named pybluez ImportError:没有名为pybluez的模块

Do you know how to solve this problem? 你知道如何解决这个问题吗? I've already looked in forums but I can't get the right solution. 我已经看过论坛,但找不到正确的解决方案。 Maybe I am missing some details but I don't know what.. 也许我错过了一些细节,但我不知道该怎么办..

use 采用

 pip install PyBluez 

and then run the same code, it will run. 然后运行相同的代码,它将运行。 And if you don't know about pip,just google it on or go to this http://pythonprogramming.net/using-pip-install-for-python-modules/ 如果您不了解pip,请在Google上进行搜索或访问http://pythonprogramming.net/using-pip-install-for-python-modules/

Hoping it will help you. 希望对您有帮助。

In python modules usually distributed using pip i suggest you to install it because if the module you are trying to install have dependencies pip will also handle that for you. 在通常使用pip分发的python模块中,我建议您安装它,因为如果要安装的模块具有依赖项, pip也会为您处理。 You can install it like its described in here . 您可以按照此处所述安装它。 After installing you can install the module you want like below. 安装后,您可以按照以下方式安装所需的模块。 It is also explained in github page 在github页面上也有解释

pip install pybluez

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM