我有一个名为 update.py 的 python 脚本,我想使用另一个 python 脚本来检查该脚本是否正在运行。如果 update.py 未运行或出错,则脚本将运行 update.py。
我可以做吗?如果有例子那就非常感谢了。
我正在尝试从最初用于另一个(可能是基于 Debian 的)Linux 发行版的 github 存储库安装基于 Python 的软件包。
程序好像用的是Python2,导入如下:
import argparse
import logging
import Queue
import collections
import ConfigParser
import os
import socket
import random
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
from multiprocessing import Process, Queue as MPQueue, Event
...
def notif(msg):
Notify.init("TheProg")
notice = Notify.Notification.new("Critical !", msg)
notice.set_urgency(2)
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试运行该程序时,我得到了这个:
$ python2 main.py -h
Traceback (most recent call last):
File "main.py", line 11, in <module>
gi.require_version('Notify', '0.7')
File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 100, in require_version
raise ValueError('Namespace %s not available' …Run Code Online (Sandbox Code Playgroud) 我对服务的自动运行有疑问。我想在用户登录后运行脚本。一旦我成功了,但是当我尝试使其自动化时,就会遇到错误,并且找不到错误。
服务:
Description=Service desc
[Service]
Type=oneshot
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/albert/.Xauthority
Environment=HOME=/home/albert/
User=albert
Group=albert
RemainAfterExit=true
StandardOutput=journal
ExecStart=/home/albert/.startup-script.sh
[Install]
WantedBy=default.target
Run Code Online (Sandbox Code Playgroud)
位置:/home/albert/.config/systemd/user/startup-service.service
权限:-rw-r--r-- 1 albert albert 306 Jan 2 14:49 startup-service.service
脚本
权限:-rwxr-xrx 1 albert albert 86 Jan 2 13:30 /home/albert/.startup-script.sh
日志记录
Jan 02 17:03:27 irpi-epsilon systemd[734]: Service desc
-- Subject: Unit UNIT has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit UNIT has begun starting up.
Jan 02 17:03:27 irpi-epsilon systemd[1025]: startup-script.service: Failed at step GROUP spawning /home/albert/.startup-script.sh: Operation not permitted …Run Code Online (Sandbox Code Playgroud) 如果我通过 NOOBS 安装了 Windows 10 IOT Core (10.0.16299.15),Windows 10 IOT Core Dashboard 的密码是什么?
我正在尝试获得一个基于RaspberryPi3 Python的鸟舍,以阅读其自己上传的视频的受欢迎程度(这使它能够推断出应该删除的视频,并避免数百个上传的文件)。我认为阅读#views /#likes的最好方法是使用yt_analytics_report.py
当我输入时,它总是返回0值:
当我输入:
$python yt_analytics_report.py --filters="video==bb_o--nP1mg"
Run Code Online (Sandbox Code Playgroud)
要么
$python yt_analytics_report.py --filters="channel==UCGXIq7h2UeFh9RhsSEsFsiA"
Run Code Online (Sandbox Code Playgroud)
输出为:
$ python yt_analytics_report.py --filters =“ video == bb_o--nP1mg” {'metrics':'views,estimatedMinutesWatched,averageViewDuration','filters':'video == bb_o--nP1mg','ids:' channel == MINE','end_date':'2018-01-12','start_date':'2018-01-06'}
请访问此URL以授权此应用程序:[注意:此处是带有其他序列的url等。结果]:
观看次数估计数MinutesWatched averageViewDuration 0.0 0.0 0.0
我是新来的;最近3天,我一直在测试各种过滤器,但结果始终相同。我想我做错了严重的事情。(自动传感器触发的)视频上传效果非常好,因此我认为根本原因与我使用yt-analytics示例的方式有关。如有任何关于rootcause的建议或替代方法,以检索自己上传的youtube的#views /#likes。
python google-api youtube-api youtube-data-api raspberry-pi3
你好美丽的社区。我正在树莓上开发 tkinter GUI。好吧,首先我开始在 Windows 上对我的 gui 进行编程,我想让我的按钮在屏幕上看起来平坦,边缘没有任何线条,并且使用救济 =“平坦”效果很好,但是当我完成我的项目并在我的树莓上运行我的程序时我的按钮在边缘上有那些线,似乎救济 = 平坦 没有任何效果,我尝试使用救济 = FLAT,但仍然存在同样的问题
在这里您可以看到正在运行的程序的屏幕截图以及我的按钮周围的线条
这是我的代码
bouton_break = Button(f2, image=img_break, relief='flat' , command = break_ ) #break
bouton_break.place(bordermode=OUTSIDE, height=134, width=107, x=40 , y=200)
bouton_MM = Button(f2, image=img_MM, relief='flat', command=maint_page)
bouton_MM.place(bordermode=OUTSIDE, height=134, width=107, x=170 , y=200)
boutonlogout = Button(f2, image=img_logout , relief='flat', command = logout_cmd) #logout
boutonlogout.place(bordermode=OUTSIDE, height=134, width=107, x=300 , y=200)
Run Code Online (Sandbox Code Playgroud) 已解决了以下有关如何在RPI3上下载HEROKU CLI的阅读答案
只是说。抱歉,之前是否有人问过-我无法找到它。
我有一个Raspberry PI 3,并且正在尝试安装Heroku CLI。如果我尝试以正常方式执行此操作(对于ubuntu或linux),它将失败。无法在Raspbian剂量wokr 上安装Heroku CLI,因为我得到了错误
wget https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
Run Code Online (Sandbox Code Playgroud)
--2018-05-23 17:15:46-- https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
解决cli-assets.heroku.com(cli- asset.heroku.com)... 54.230.9.187,54.230.9.194,54.230.9.84,...正在
连接至cli-assets.heroku.com(cli-assets.heroku.com)| 54.230.9.187 |:443。 .. 连接的。
HTTP请求已发送,正在等待响应... 404未找到
2018-05-23 17:15:50
错误404:未找到。
但是,此帖子可以在 Heroku CLI替代下载位置工作, 并返回错误
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
dpkg: error processing package heroku (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of heroku-toolbelt:
heroku-toolbelt depends on heroku (= 3.99.4); …Run Code Online (Sandbox Code Playgroud) 我试图通过套接字发送 29 位 EFF CAN 消息,但由于某种原因,它使用 11 位标识符发送它们,从 ID 中删除 5 个字节。使用环回模式,通过 candump 我可以看到消息以 11 位形式接收。
我没有收到任何错误,什么也没有,这就是我感到困惑的原因
我正在使用树莓派 3b+,如果这有什么区别的话。和 Can-utils 库。
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
#include </home/pi/can-utils/lib.h>
int main(int argc, char **argv)
{
int s,loop = 1;
int nbytes;
struct sockaddr_can addr;
struct can_frame frame;
struct ifreq ifr;
//can interface
if((s=socket(PF_CAN, SOCK_RAW, CAN_RAW))<0){
perror("socket");
return 1;
}
strcpy(ifr.ifr_name, "can0");
if(ioctl(s, SIOCGIFINDEX, &ifr) …Run Code Online (Sandbox Code Playgroud) 我使用 RPI3B 并尝试安装 Virtualenvwrapper 和 Virtualenvs。在我添加之后
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)
在 ~/.profile 中。然后source ~ ~/.profile
我使用mkvirtualenv cv -p python2. 之后我收到这些消息:
created virtual environment CPython2.7.16.final.0-32 in 672ms
creator CPython2Posix(dest=/home/pi/.virtualenvs/cv, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy,
app_data_dir=/home/pi/.local/share/virtualenv/seed-v1)
activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/cv/usr/local/bin/predeactivate
ERROR: Environment '/home/pi/.virtualenvs/cv' does not contain an activate script.
Run Code Online (Sandbox Code Playgroud)
但我不能使用 workon cv。最后的消息一次又一次地出现。我该如何解决?我也尝试重新安装,但没有帮助。
python virtualenv virtualenvwrapper raspberry-pi raspberry-pi3
我做了一个简单的性能比较,侧重于使用C#的浮点运算,针对带有Windows 10 IoT的Raspberry Pi 3 Model 2,我将它与Intel Core i7-6500U CPU @ 2.50GHz进行了比较.
Raspberry Pi 3 Model B V1.2 - 测试结果 - 图表
英特尔酷睿i7-6500U CPU @ 2.50GHz - x64测试结果 - 图表
英特尔酷睿i7 仅比Raspberry Pi 3 快十二倍(x64)! - 根据那些测试.
准确度为11.67,并计算每个平台在这些测试中实现的最佳性能.两个平台在并行运行的四个线程中实现了最佳性能(非常简单,独立的计算).
问题:测量和比较这些平台的计算性能的正确方法是什么?目的是比较优化算法,机器学习算法,统计分析等领域的计算性能.因此,我的重点是浮点运算.
有一些基准测试(如MWIPS)和MIPS或FLOPS等测量.但我没有找到一种方法来比较不同的CPU平台的计算能力.
我找到了Roy Longbottom的一个比较(谷歌"Roy Longbottom的Raspberry Pi,Pi 2和Pi 3基准" - 我不能在这里发布更多链接)但根据他的基准测试,Raspberry Pi 3的速度只比英特尔酷睿i7快4倍(x64)建筑,MFLOPS比较).与我的结果非常不同.
以下是我执行的测试的详细信息:
测试是围绕应该迭代执行的简单操作构建的:
private static float SingleAverageCalc(float seed, long nTimes)
{
float x1 = seed, x2 = …Run Code Online (Sandbox Code Playgroud) raspberry-pi3 ×10
python ×5
raspberry-pi ×2
bash ×1
c ×1
c# ×1
can-bus ×1
google-api ×1
heroku ×1
intel ×1
notify ×1
pip ×1
pygobject ×1
raspbian ×1
socketcan ×1
systemctl ×1
systemd ×1
tkinter ×1
virtualenv ×1
youtube-api ×1