没有名为 cairo 的模块 - python 和 pip
no module named cairo - python and pip
我正在尝试构建 openuds
,但出现错误 no module name cairo
,我浏览了一下,发现安装 pycairo
可以解决问题。 1) 如何修复此安装错误?
python manage.py createcachetable
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/hari/openuds/testuds-master/server/src/uds/__init__.py", line 78, in ready
from . import REST # To make sure REST initializes all what it needs
File "/home/hari/openuds/testuds-master/server/src/uds/REST/__init__.py", line 210, in <module>
Dispatcher.initialize()
File "/home/hari/openuds/testuds-master/server/src/uds/REST/__init__.py", line 206, in initialize
__import__(__name__ + '.' + package + '.' + name, globals(), locals(), [], -1)
File "/home/hari/openuds/testuds-master/server/src/uds/REST/methods/reports.py", line 38, in <module>
from uds import reports
File "/home/hari/openuds/testuds-master/server/src/uds/reports/__init__.py", line 80, in <module>
__init__()
File "/home/hari/openuds/testuds-master/server/src/uds/reports/__init__.py", line 76, in __init__
__import__(name, globals(), locals(), [])
File "/home/hari/openuds/testuds-master/server/src/uds/reports/stats/__init__.py", line 35, in <module>
from .login import StatsReportLogin, StatsReportLoginCSV
File "/home/hari/openuds/testuds-master/server/src/uds/reports/stats/login.py", line 45, in <module>
import cairo
ImportError: No module named cairo
所以我尝试安装 pycairo,但出现以下错误,请有人帮助我
python -m pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/a6/54/23d6cf3e8d8f1eb30e0e58f171b6f62b2ea75c024935492373639a1a08e4/pycairo-1.18.0.tar.gz
Building wheels for collected packages: pycairo
Running setup.py bdist_wheel for pycairo ... error
Complete output from command /home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-sp61DQ --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-2.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
Complete output from command /home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-SBY9Xo/install-record.txt --single-version-externally-managed --compile --install-headers /home/hari/openuds/testuds-master/Python-2.7.14/env/include/site/python2.7/pycairo:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-2.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
Command "/home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-SBY9Xo/install-record.txt --single-version-externally-managed --compile --install-headers /home/hari/openuds/testuds-master/Python-2.7.14/env/include/site/python2.7/pycairo" failed with error code 1 in /tmp/pip-install-_hOJAx/pycairo/
2) 同样在 Java 中,我们有 maven,它将像这样自行安装依赖项 是否有其他工具可用于构建 python 包?
Pycairo 是 cairo graphics library. Pycairo doesn't provide 预编译二进制轮的 Python 绑定,因此 pip
必须从源代码编译它。要编译 Pycairo,你需要安装 cairo。所以从
开始
apt install libcairo2
或从您的发行版安装绑定:
apt install python-cairo
我正在尝试构建 openuds
,但出现错误 no module name cairo
,我浏览了一下,发现安装 pycairo
可以解决问题。 1) 如何修复此安装错误?
python manage.py createcachetable
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/hari/openuds/testuds-master/Python-2.7.14/env/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/hari/openuds/testuds-master/server/src/uds/__init__.py", line 78, in ready
from . import REST # To make sure REST initializes all what it needs
File "/home/hari/openuds/testuds-master/server/src/uds/REST/__init__.py", line 210, in <module>
Dispatcher.initialize()
File "/home/hari/openuds/testuds-master/server/src/uds/REST/__init__.py", line 206, in initialize
__import__(__name__ + '.' + package + '.' + name, globals(), locals(), [], -1)
File "/home/hari/openuds/testuds-master/server/src/uds/REST/methods/reports.py", line 38, in <module>
from uds import reports
File "/home/hari/openuds/testuds-master/server/src/uds/reports/__init__.py", line 80, in <module>
__init__()
File "/home/hari/openuds/testuds-master/server/src/uds/reports/__init__.py", line 76, in __init__
__import__(name, globals(), locals(), [])
File "/home/hari/openuds/testuds-master/server/src/uds/reports/stats/__init__.py", line 35, in <module>
from .login import StatsReportLogin, StatsReportLoginCSV
File "/home/hari/openuds/testuds-master/server/src/uds/reports/stats/login.py", line 45, in <module>
import cairo
ImportError: No module named cairo
所以我尝试安装 pycairo,但出现以下错误,请有人帮助我
python -m pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/a6/54/23d6cf3e8d8f1eb30e0e58f171b6f62b2ea75c024935492373639a1a08e4/pycairo-1.18.0.tar.gz
Building wheels for collected packages: pycairo
Running setup.py bdist_wheel for pycairo ... error
Complete output from command /home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-sp61DQ --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-2.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
Complete output from command /home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-SBY9Xo/install-record.txt --single-version-externally-managed --compile --install-headers /home/hari/openuds/testuds-master/Python-2.7.14/env/include/site/python2.7/pycairo:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-2.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-2.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
Command "/home/hari/openuds/testuds-master/Python-2.7.14/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_hOJAx/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-SBY9Xo/install-record.txt --single-version-externally-managed --compile --install-headers /home/hari/openuds/testuds-master/Python-2.7.14/env/include/site/python2.7/pycairo" failed with error code 1 in /tmp/pip-install-_hOJAx/pycairo/
2) 同样在 Java 中,我们有 maven,它将像这样自行安装依赖项 是否有其他工具可用于构建 python 包?
Pycairo 是 cairo graphics library. Pycairo doesn't provide 预编译二进制轮的 Python 绑定,因此 pip
必须从源代码编译它。要编译 Pycairo,你需要安装 cairo。所以从
apt install libcairo2
或从您的发行版安装绑定:
apt install python-cairo