【发布时间】:2015-12-19 04:28:54
【问题描述】:
我是 Linux 世界的新手,并且正在为 BBB(Beaglebone Black,我相信你们都知道)的项目而苦苦挣扎,我的学习曲线相当缓慢,但它正在变得更好。
由于是Debian,所以puTTY是我在Windows中的终端,但是现在我需要导入一个库,它无法理解import,因为它是一个Python命令,我必须使用shebang行。
但是如何在 puTTY 中使用它?使用#!/usr/bin/python
在终端中的命令显然不起作用之前?
当我输入:
import Adafruit_BBIO.GPIO as GPIO
它显然说:
-bash: import: command not found
我正在尝试这样做:
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/using-the-bbio-library
而且我已经通过了这一步:
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu
因为我的列表是这样的:
debian@beaglebone:~$ ls -al
total 44
drwxr-xr-x 4 debian debian 4096 Dec 19 03:28 .
drwxr-xr-x 3 root root 4096 Nov 12 21:12 ..
drwx------ 3 root root 4096 Nov 12 21:14 .BBIOServer
-rw-r--r-- 1 debian debian 220 Nov 12 2014 .bash_logout
-rw-r--r-- 1 debian debian 3515 Nov 12 2014 .bashrc
-rw------- 1 root root 7 Nov 12 21:18 .gitconfig
-rw------- 1 110 116 113 Nov 12 21:15 .npmrc
-rw------- 1 debian debian 186 Nov 12 21:12 .pastebinit.xml
-rw-r--r-- 1 debian debian 675 Nov 12 2014 .profile
-rw------- 1 debian debian 64 Nov 12 21:12 .xsessionrc
drwx------ 2 debian debian 4096 Nov 12 21:12 bin
有什么想法吗?
【问题讨论】:
-
只是让您知道您的链接已损坏
-
你只能在python文件中使用
#!/usr/bin/python,即shebang(或hashbang)。如果您在 Shell 中,我认为您需要在导入任何 python 模块之前通过python命令输入 Python Shell。 -
谢谢@wilbur。它们现在已经修好了。
-
@KevinGuan 如果您检查第二个链接,我想我已经安装了 Python Shell。谢谢你完美的编辑顺便说一句。或者我最好问问,我该怎么做?
-
type
python... 然后当shell启动时输入from ... import ...
标签: python import putty beagleboneblack