2017-12-19 39 views
0

私はAnaconda Python環境にdbusをインストールしようとしていますが、苦労しています。ここでAnacondaでPython Dbusバインディングを使用する方法

[email protected]:~$ python 
Python 3.5.4 |Anaconda custom (64-bit)| (default, Oct 13 2017, 11:22:58) 
[GCC 7.2.0] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import dbus 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/e/anaconda3/lib/python3.5/site-packages/dbus/__init__.py", line 77, in <module> 
    import dbus.types as types 
    File "/home/e/anaconda3/lib/python3.5/site-packages/dbus/types.py", line 6, in <module> 
    from _dbus_bindings import (
ImportError: /home/e/anaconda3/lib/python3.5/site-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStruct 
>>> 

は私が考えるの出力の一部が求められることがありますされています:

[email protected]:~$ conda install dbus 
Fetching package metadata ........... 
Solving package specifications: . 

# All requested packages already installed. 
# packages in environment at /home/e/anaconda3: 
# 
dbus      1.10.22    h3b5a359_0 


[email protected]:~$ sudo apt-get install libdbus-glib-1-dev libdbus-1-dev 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
libdbus-glib-1-dev is already the newest version (0.106-1). 
libdbus-1-dev is already the newest version (1.10.6-1ubuntu3.3). 
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 


[email protected]:~$ sudo apt-get install dbus 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
dbus is already the newest version (1.10.6-1ubuntu3.3). 
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 


[email protected]:~$ which python 
/home/e/anaconda3/bin/python 


[email protected]:~$ conda --version 
conda 4.3.31 

[email protected]:~$ sudo /home/e/anaconda3/bin/python -m pip install dbus-python 
The directory '/home/e/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/home/e/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Requirement already satisfied: dbus-python in ./anaconda3/lib/python3.5/site-packages 

Dバスは、システムのpythonには罰金がない取り組んでいる。ここ

は、私が取得していますエラーメッセージですAnaconda Pythonで作業しています。

のPython 2.7:

[email protected]:~$ which python 
/usr/bin/python 
[email protected]:~$ python 
Python 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import dbus 
>>> 

のPython 3.5:

[email protected]:~$ which python3 
/usr/bin/python3 
[email protected]:~$ python3 
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import dbus 
>>> 

誰も私を助けることができますか?私はここで露骨に明白な何かを逃していますか?

ありがとうございます。

答えて

0

私は同様の問題を抱えていましたが、dbusとpythonの場合はほとんどありませんdon't work well out-of-the-box。 dbusを動作させるには、システムレベルのインストール(つまり、apt-get)が必要であるとのコンセンサスがあるようです。私はあなたが見ているエラー/home/e/anaconda3/lib/python3.5/site-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStructがそれに直接関係していると信じています。

conda install dbusあなたはDBUSのtarball https://anaconda.org/conda-forge/dbusの内容を分析するとき、それはすべてのCファイルと実行可能ですので、これは、いくつかの理にかなっているなど、~/anaconda3/lib/python3.6/site-packagesに何も追加し、代わりにdbus-run-sessionよう~/anaconda3/bin/にいくつかの実行可能ファイルをインストールするように見える、dbus-daemonていません。私はそれがdbusのpythonモジュールであるはずだとは思っていませんが、間違っている可能性があります。

EDIT:

私はcondaリポジトリを検索し、それらがコンパイルされ、インストールされていることを、おそらく、DBUS-のpythonのバージョンをアップロードした少数の個人を見つけました。

conda install -c scottwales dbus-python

が、私はその後、dbusのをインポートすることができました:私は経由py3.6のconda環境でthis oneを試してみました。これはハックなアプローチであり、プロダクションでは使用しないでください。 カルロス・コルドバの投稿を下記に聞くことをおすすめします。しかし、解決策が必要な場合は、いくつかのユーザーコンドパッケージを検索するか、自分でライブラリをコンパイルしてみてください。

0

誰でも手伝ってもらえますか?私はここで露骨に明白な何かを逃していますか?

はい、あります。 condaについて人々がまだ理解していないことの1つがあります。condaで、pipです。 apt-getyumbrewemergeなどと同じ静脈内の一般的なパッケージマネージャですが、クロスプラットフォームとPythonをベースにしています。

この場合、conda install dbusは、pipのように、Python Dbusバインディングをインストールしません。Qt 5で必要とされるDbus Cパッケージ自体がインストールされます(C++ライブラリであり、Pythonバインディングではありません)。

残念ながら、dbus-pythonのCondaパッケージはありません。さらに悪いことに、hereと指摘されているように、パッケージを作成する簡単な方法はないようです。

最後に、あなたはここで

は、私はあなたがのPYTHONPATHにあなたのシステムのPython dist-packagesパスを追加したので、そのエラーの(最も可能性の高い)原因がある

を取得していますエラーメッセージであることを特徴としますAnaconda、またはdbusモジュールをPythonからAnacondaに盲目的にコピーしたためです。もう一度やってはいけない。システムのPythonとAnacondaパッケージは、異なるコンパイラで異なる条件でコンパイルされます。したがって、それらを混ぜることは、あなたが報告したのと同じように、理解できないエラーの原因です。