百度怎么做自己的網(wǎng)站/百度知道問答平臺
環(huán)境:虛擬機(jī)Ubuntu20.04,vscode無法安裝pycairo和PyGObject
虛擬機(jī)Ubuntu20.04,vscode中運(yùn)行Anaconda搭建的vens 的Python3.8.10
首先在vscode中點(diǎn)擊ctrl+shift+p,選擇Python3.8.10的環(huán)境,自動激活Python
最近在搞無人機(jī)精準(zhǔn)降落,網(wǎng)上下載的一段代碼,總是報錯,搞了三四天終于把環(huán)境搭好了
其中一段代碼(如下)總是報錯 ,原因就是沒有wheel,然后pycairo和PyGObject安裝不上去
import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst
報錯先是:
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
然后接著:
ERROR: Could not build wheels for PyGObject which use PEP 517 and cannot be installed directly
然后參考
- ERROR: Could not build wheels for PyGObject which use PEP 517 and cannot be installed directly #45
- ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
安裝pycairo
新建Ubuntu終端,輸入:
sudo apt-get install sox ffmpeg libcairo2 libcairo2-dev
sudo apt-get install texlive-full
完成以后,基本可以安裝pycairo==1.21.0
在vscode的Python終端輸入:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pycairo==1.21.0
如果不行的話,先輸入:
pip3 install manimlib # or pip install manimlib
pip3 install manimce # or pip install manimce
然后再次輸入
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pycairo==1.21.0
安裝PyGObject
新建Ubuntu終端輸入:
sudo apt install libgirepository1.0-dev
然后在vscode輸入
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PyGObject==3.42.2
如下圖:
筆者采用這種辦法解決長久折磨我的問題,然后import gi 和Gst都不報錯了,如果還是不成功,可以點(diǎn)進(jìn)我參考的GitHub網(wǎng)址:https://github.com/gfduszynski/cm-rgb/issues/45
找尋其他人成功的方法