gpt4 book ai didi

python - 无法安装 `gattlib`

转载 作者:行者123 更新时间:2023-12-01 00:03:29 24 4
gpt4 key购买 nike

我正在尝试安装gattlib在 Python 中,以便使用它的一些蓝牙工具。

操作系统是 ubuntu 18.04.4 LTS。

我现在已经尝试了以下方法(例如 here ):

sudo apt-get install mercurial
hg clone https://bitbucket.org/OscarAcena/pygattlib
cd pygattlib
cat DEPENDS
sudo apt-get install libboost-thread-dev libboost-python-dev libbluetooth-dev libglib2.0-dev python-dev
sudo python3 setup.py install

给出(我的Python是3.6.9):

usr/bin/ld: cannot find -lboost-python36
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

另外,我尝试过:

sudo apt install python3-gattlib

给出:

the following packages have unmet dependencies:
python3-gattlib: Depends: python3 (>= 3.7~) but 3.6.7-1~18.04 is to be installed
Depends: libboost-python1.67.0 but is is not installable
Depends: libboost-thread1.67.0 but is is not installable

尽管 libboost-python 和 libboost-thread 在第一次尝试中已成功安装(见上文),并且 python3 返回 Python 3.6.9

pip3 install gattlib

显示:

Building wheel for gattlib(setup.py) ... error

Running setup.py install for gattlib ... error

这与我从 (following instructions from this question): 得到的结果完全相同

sudo pip3 download gattlib  
sudo tar xvzf ./gattlib-0.20200122.tar.gz
cd gattlib-0.20200122/
sudo sed -ie 's/boost_python-py34/boost_python36/' setup.py
pip3 install .

我认为这是在运行安装文件之前对安装文件进行必要的调整,因为,如果我理解正确的话,Python版本在某种程度上被错误地硬编码在其中。

我尝试过但没有帮助的其他事情:

pip3 install --upgrade setuptools
sudo apt-get install python3.6-dev libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo apt-get install libpython-dev
sudo apt-get install libevent-dev
sudo pip3 install gattlib
wget -qO- http://pike.esi.uclm.es/add-pike-repo.sh | sudo sh
sudo apt update
sudo apt install python3-gattlib
sudo apt-get install libbluetooth-dev
pip3 install --upgrade pip
sudo apt-get install mercurial
pip3 install gattlib
sudo apt-get install libboost-all-dev

cd /usr/lib/x86-64-linux-gnu
sudo ln -s libboost_python-py35.so libboost_python-py36.so

sudo apt-get install libbluetooth-dev bluez bluez-hcidump libboost-python-dev libboost-thread-dev libglib2.0-dev

hg clone https://bitbucket.org/OscarAcena/pygattlib
cd pygattlib
cat DEPENDS
sudo apt-get install libboost-thread-dev libboost-python-dev libbluetooth-dev libglib2.0-dev python-dev
sudo python3 setup.py install
sudo python setup.py install

pip3 install gTTS

sudo apt-get install python3 python-dev python3-dev \
build-essential libssl-dev libffi-dev \
libxml2-dev libxslt1-dev zlib1g-dev \
python-pip
sudo apt-get install aptitude
sudo aptitude install libboost-all-dev

最佳答案

我运行

sudo python3 setup.py install

我也收到错误

usr/bin/ld: cannot find -lboost-python36

因为我没有 boost-python36.a 但有 boost-python3-py36.a

(我使用locate boost-python3找到了这个文件,它使用带有文件名的数据库,因此它比find工作得更快,但它可能不会默认安装)

我必须编辑setup.py并更改

boost_libs = ["boost_python3"+str(sys.version_info.minor)]

boost_libs = ["boost_python3-py36"]

或更通用

boost_libs = ["boost_python3-py3"+str(sys.version_info.minor)]
<小时/>

基于 Ubuntu 18.04 测试了 od Linux Mint 19.3 Tricia

关于python - 无法安装 `gattlib`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60152996/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com