与this question类似,我正在尝试在raspbian上安装blink1库。
但无论我尝试什么,我都会得到:
>>>import blink1
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import blink1
ImportError: No module named blink1
我通过pip安装它,据我所知,它在正确的路径中:
pi@raspberrypi ~ $ ls /usr/local/lib/python2.7/dist-packages/
blink1 python_jenkins-0.4.8.dist-info
blink1-0.0.12.dist-info pyusb-1.0.0rc1.egg-info
blink1_tests setuptools
click setuptools-18.3.1.dist-info
click-5.1.dist-info six-1.9.0.dist-info
configobj-5.0.6.dist-info six.py
configobj.py six.pyc
configobj.pyc usb
easy_install.py validate.py
easy_install.pyc validate.pyc
jenkins _version.py
_markerlib _version.pyc
pbr webcolors-1.5.dist-info
pbr-1.7.0.dist-info webcolors.py
pip webcolors.pyc
pip-7.1.2.dist-info wheel
pkg_resources wheel-0.24.0.dist-info
我不知道我现在应该尝试什么...
编辑:它似乎不适用于pyhthon3:
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import blink1
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import blink1
ImportError: No module named blink1
$ sudo pip-3.2 install blink1
Requirement already satisfied (use --upgrade to upgrade): blink1 in /usr/local/lib/python3.2/dist-packages
编辑2:最后一个问题可能与以下事实有关:在此安装中,sys.path只包含2.7库,而不包含v3 dist-packages ......
答案 0 :(得分:1)
/usr/local/lib/python2.7/dist-packages/blink1 /
中缺少__init__.py文件如果你跑
touch /usr/local/lib/python2.7/dist-packages/blink1/__init__.py
它应该开始工作。