Raspberry Pi - Python中的GPIO(Raspberry Pi - GPIO in Python)
我试图让我的Raspberry Pi的GPIO引脚工作,我正在遵循教程:如何像Arduino一样使用你的Raspberry Pi 。
(我正在通过运行Raspbian的SSH工作。)我已经成功安装了分发版。
在尝试安装PIP时,我收到如下所示的错误。
我该如何解决它?
pi@DuckPi ~ $ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 85929 100 85929 0 0 89250 0 --:--:-- --:--:-- --:--:-- 103k Downloading/unpacking pip Running setup.py egg_info for package pip warning: no files found matching '*.html' under directory 'docs' warning: no previously-included files matching '*.txt' found under directory 'docs/_build' no previously-included directories found matching 'docs/_build/_sources' Installing collected packages: pip Running setup.py install for pip error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt: running install running build running build_py running install_lib creating /usr/local/lib/python2.7/dist-packages/pip error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied ---------------------------------------- Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt failed with error code 1 Storing complete log in /home/pi/.pip/pip.log
I am trying to get my Raspberry Pi's GPIO pins working, and I am following Tutorial: How to use your Raspberry Pi like an Arduino.
( I'm working through SSH running Raspbian.) I have successfully installed distribute.
When trying to install PIP, I get the error shown below.
How can I fix it?
pi@DuckPi ~ $ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 85929 100 85929 0 0 89250 0 --:--:-- --:--:-- --:--:-- 103k Downloading/unpacking pip Running setup.py egg_info for package pip warning: no files found matching '*.html' under directory 'docs' warning: no previously-included files matching '*.txt' found under directory 'docs/_build' no previously-included directories found matching 'docs/_build/_sources' Installing collected packages: pip Running setup.py install for pip error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt: running install running build running build_py running install_lib creating /usr/local/lib/python2.7/dist-packages/pip error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied ---------------------------------------- Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt failed with error code 1 Storing complete log in /home/pi/.pip/pip.log
原文:https://stackoverflow.com/questions/13866328
更新时间:2022-05-04 21:05
最满意答案
直截了当的正则表达式:
var str = "abc kskd 8.900 prew"; var result = Regex.Split(str, @"\W(\d.*)").Where(x => x!="").ToArray();
straightforward with a regular expression:
var str = "abc kskd 8.900 prew"; var result = Regex.Split(str, @"\W(\d.*)").Where(x => x!="").ToArray();
相关问答
更多-
使用NumberFormatInfo尝试类似于此答案的内容: NumberFormatInfo format = new NumberFormatInfo(); format.NumberGroupSeparator = " "; format.NumberGroupSizes = new[] { 4 }; format.NumberDecimalDigits = 0; 用于: long number = 7314787188619939; string formatted = number.ToStri ...
-
我不认为韩语在这里有任何相关性......我能想到的唯一问题就是在前3个字符之后的那个讨厌的逗号会阻止你使用直接的s.split()但正则表达式是强大的! import re s = '굿모닝, Today is 촉촉' re.split(',?\s', s) 输出['굿모닝', 'Today', 'is', '촉촉'] 只需用可选的逗号分隔你的字符串,? 后跟一个非可选的白色字符\s I don't think Korean has any relevance here... The only issu ...
-
如何使用python re.split来分割字符串,但保留数字?(how to use python re.split to split string but keep digits?)[2022-08-03]
你可以使用re.findall : import re s = "100,[+split" new_s = re.findall('\d+|[a-zA-Z\W]', s) 输出: ['100', ',', '[', '+', 's', 'p', 'l', 'i', 't'] You can use re.findall: import re s = "100,[+split" new_s = re.findall('\d+|[a-zA-Z\W]', s) Output: ['100', ',', ... -
怎么样 var isnum = /^\d+$/.test(val); how about var isnum = /^\d+$/.test(val);
-
使用regexp_replace(): SELECT c.rownr , regexp_replace (c.comments, e'.*[Ii][Dd][^0-9]*([0-9]+).*', '\1' ) AS the_id , c.comments AS comments FROM comments c ; .*匹配最初的垃圾 `[Ii] [Dd]匹配Id字符串,案例无关紧要 [^0-9]*非数字字符 ([0-9]+)匹配所需的数字字符串 .*匹配任何尾 ...
-
因此,如果图像是包含用逗号分隔的图像的字符串(例如“apples.jpg,tomatoes.jpg ......”) 你可以这样做: String[] pics = images.split(","); //I use StringBuilder because String is immutable and this is better to build a dynamic one StringBuilder urlsString = new StringBuilder(); for(int i=0; ...
-
拆分包含数字的字符串(Split a string containing digits)[2024-04-08]
直截了当的正则表达式: var str = "abc kskd 8.900 prew"; var result = Regex.Split(str, @"\W(\d.*)").Where(x => x!="").ToArray(); straightforward with a regular expression: var str = "abc kskd 8.900 prew"; var result = Regex.Split(str, @"\W(\d.*)").Where(x => x!="").T ... -
你可以让正则表达式做所有繁重的工作,首先将你的字符串分成几对: String[] pairs = aString.split("\\?(?!\\?)"); 那个正则表达式意味着“a?没有后跟?”,它给出了: [name==p==, header=hello, aname=????, lname=lastname] 然后还将结果拆分为名称/值,仅拆分第一个“=”: String[] split = pair.split("=", 2); // max 2 parts 把它们放在一起: String aS ...
-
拆分包含前导数字的字符串以及之后的所有内容(Split a string consisting into leading numbers and everything after that)[2022-04-13]
Groups[0]始终是完整匹配的字符串。 Groups[1]将是您的第一个小组。 您的代码应如下所示: inst_no = match.Groups[1].Value; dest_filename = match.Groups[2].Value; Groups[0] always is the complete matched string. Groups[1] will be your first sub-group. Your code should look like this: inst_no ... -
没那么难: 从右边开始,我将取一次2位数,第二次取1位数。 使用slice 。 然后我将使用unshift在数组的开头推送它。 我正在使用一个标志,知道何时只取一个参数,何时取两个参数(对标志) m(1) m(12) m(123) m(1234) m(12345) m(123456) m(12345678) m(123456789) m(1234567890) function m(x){ x=x.toString() var a=[] var v; var y=2 ...