Tag: python

无法导入pyhdf

我需要阅读从网站https://ladsweb.modaps.eosdis.nasa.gov/下载的MODIS HDF4文件,搜索我的项目。 我需要使用Pyhdf模块编写一个python程序来打开并读取文件,所以,我安装了库libhdf4-dev和模块python-h5py如下所示错误:找不到输入文件:`man / Makefile.in’ 。 完成所有这些后,我仍然无法导入pyhdf。 当我尝试使用命令import pyhdf 。 我收到以下错误 File “”, line 1, in import pyhdf ImportError: No module named pyhdf 我怎样才能导入pyhdf?

PyQt5中的哪个Gstreamer?

在Ubuntu 16.04和18.04,每当我尝试使用QMediaPlayer我都会被提示没有服务。 >>> from PyQt5 import QtMultimedia >>> qtm = QtMultimedia.QMediaPlayer() defaultServiceProvider::requestService(): no service found for – “org.qt-project.qt.mediaplayer” 互联网建议安装一些gstreamer包,但它没有说明。 我怎样才能确定需要哪个包? 似乎默认情况下Ubuntu附带Gstreamer1.0 ,我可以运行gst-play-1.0 FILEPATH 。 相反需要gstreamer-0.10机会吗? 如何设置逆转依赖? 我安装的软件包 notlaptop@laptop$ apt list –installed | grep gstream gir1.2-gstreamer-1.0/bionic,now 1.14.0-1 amd64 [installed] gstreamer1.0-alsa/bionic,now 1.14.0-2ubuntu1 amd64 [installed] gstreamer1.0-clutter-3.0/bionic,now 3.0.26-1 amd64 [installed] gstreamer1.0-gl/bionic,now 1.14.0-2ubuntu1 amd64 [installed] gstreamer1.0-packagekit/bionic,now 1.1.9-1ubuntu2 amd64 [installed] gstreamer1.0-plugins-bad/bionic,now […]

如何仅强制应用程序的一个实例?

我正在快速开发一个程序。 我正在使用一个可以隐藏/显示主窗口的指示器。 但是当我从启动器启动应用程序时,它会启动该应用程序的新实例(因此将显示另一个指示符)。 而不是只显示以前运行的应用程序的主窗口。 强制只有一个指标的常用方法是什么?

如何在Ubuntu上正确安装多个非软件包Distribute / virtualenv / pip生态系统?

我正在Ubuntu中开发Python应用程序。 我想设置一个Distribute / virtualenv / pip生态系统来独立于任何系统Python包管理我的Python包(我在Synaptic中管理,或者我让系统为我管理它们)。 我可以安装python-setuptools,python-virtualenv和python-pip系统包,并以我的快乐方式,但我也希望能够获得最新/特定版本的Distribute,virtualenv和pip。 这些没有PPA,所以我必须手动安装它们。 最后的复杂情况是,我希望能够为多个版本的Python执行此操作。 也就是说,为python2.6设置一个生态系统,为python设置另一个生态系统,为python3设置另一个生态系统,或者为chrooted 32位Python设置另一个生态系统。 我猜这个过程会是这样的: 使用Python X将我自己的Distribute副本安装到我的主文件夹中的某个位置 使用indie Distribute,easy_install pip 使用indie pip,安装virtualenv 使用indie virtualenv,创建虚拟环境 激活虚拟环境,安装包 重复Python Y,Z和Q. 我在寻找哪些安装/配置选项?

为什么/ dev / rfcomm0会出现PySerial问题?

我正在通过蓝牙将我的Ubuntu盒连接到无线读出设置。 我写了一个Python脚本来通过/ dev / rfcomm0发送串行信息。 该脚本连接正常并工作几分钟,但随后Python将开始使用100%CPU并且消息不再流过。 我可以在串口终端打开rfcomm0并通过手工沟通就好了。 当我通过终端打开它时,似乎无限期地工作。 此外,我可以将蓝牙接收器换成USB电缆,并将端口更改为/ dev / ttyUSB0,随着时间的推移我不会遇到任何问题。 似乎我正在做rfcomm0的错误或者PySerial没有很好地处理它。 这是脚本: import psutil import serial import string import time sampleTime = 1 numSamples = 5 lastTemp = 0 TEMP_CHAR = ‘t’ USAGE_CHAR = ‘u’ SENSOR_NAME = ‘TC0D’ gauges = serial.Serial() gauges.port = ‘/dev/rfcomm0’ gauges.baudrate = 9600 gauges.parity = ‘N’ gauges.writeTimeout = 0 […]

如何通过pip安装?

我也是ubuntu和python的新手。 在ubuntu终端中通过pip安装不同的打包时,它会给出权限被拒绝的错误.Ex: pip3 install numpy 但是当我在运行sudo su之后运行相同的命令时,它的工作非常完美。 这个sudo su在这做什么? 我何时应该使用该命令? 一般来说它究竟做了什么?

如何将python路径重置为/ usr / bin / python?

我按照某些说明安装了一个软件包,最后安装了另一个版本的python并创建了符号链接(这个名字我记不得了)。 现在当我从终端点击python时,它指向/usr/local/python2.7/bin/python2.7 。 我需要将默认python重置为/usr/bin/python 。 怎么做? $ which python /usr/bin/python $ whereis python python: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python /etc/python2.7 /etc/python /usr/lib/python2.7 /usr/bin/X11/python2.7-config /usr/bin/X11/python2.7 /usr/bin/X11/python /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz $ $ python bash: /usr/local/python2.7/bin/python2.7: No such file or directory $ $ /usr/bin/python Python 2.7.3 (default, Dec 18 2014, 19:10:20) [GCC 4.6.3] on linux2 Type “help”, “copyright”, […]

ImportError:没有名为easydict的模块

我正在尝试基于这个GitHub页面运行py-faster-rcnn的演示。 我已经完成了之前的所有步骤。 但是当我尝试使用python ./tools/demo.py –gpu 0 –net vgg16运行演示时python ./tools/demo.py –gpu 0 –net vgg16我收到此错误: Traceback (most recent call last): File “./tools/demo.py”, line 17, in from fast_rcnn.config import cfg File “/home/hadi/Software/py-faster-rcnn/tools/../lib/fast_rcnn/config.py”, line 23, in from easydict import EasyDict as edict ImportError: No module named easydict 我用这两个命令安装了easydict: sudo pip install easydict pip install easydict 这与python路径有关吗? 我已经安装了python 2.7和3.5。 从那时起,我得到了所有这些与python相关的错误。 […]

如何编写一键指示符(添加中间点击function)?

我非常熟练地使用菜单创建应用程序指标。 在下面的示例中,有一个菜单项(退出)。 添加另一个项目,我的实际应用程序或要运行的行,我不会有任何问题。 但是,当我尝试做的是在单击指示器图标时使项目运行。 每次单击指示器图标时,它都将运行。 要删除指示符图标,用户将单击退出。 有人能告诉我在代码中运行我的行吗? 这是指标代码: #!/usr/bin/python import os import signal import subprocess import gi gi.require_version(‘Gtk’, ‘3.0’) from gi.repository import Gtk as gtk gi.require_version(‘AppIndicator3’, ‘0.1’) from gi.repository import AppIndicator3 as appindicator APPINDICATOR_ID = ‘appreveallauncher’ def main(): indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath(‘sample_icon.svg’), appindicator.IndicatorCategory.SYSTEM_SERVICES) indicator.set_status(appindicator.IndicatorStatus.ACTIVE) indicator.set_menu(build_menu()) gtk.main() def build_menu(): menu = gtk.Menu() item_quit1 = gtk.MenuItem(‘Quit’) item_quit1.connect(‘activate’, […]

虚拟包; 离线安装问题

离线安装包有问题。 例如; python-qt4模块需要sip-api-8.1但它是一个虚拟包,因此没有要安装的.deb文件。 我该如何解决这种情况? 我知道python-sip包提供了它,但我正在寻找一个通用的解决方案。 $ apt-cache show python-qt4 Package: python-qt4 Priority: optional Section: python Installed-Size: 12103 Maintainer: Ubuntu Developers Original-Maintainer: Debian Python Modules Team Architecture: i386 Version: 4.9.1-2ubuntu1 Replaces: python-qt4-dev (<= 2.7.1-0ubuntu2), python (<= 2.3), libgcc1 (>= 1:4.1.1), libpython2.7 (>= 2.7), libqt4-dbus (>= 4:4.8.0-1~), libqt4-declarative (>= 4:4.8.0-1~), libqt4-designer (>= 4:4.8.0-1~), libqt4-help (>= 4:4.8.0-1~), libqt4-network […]