安装WeasyPrint后,我收到此错误:“Django中出错:OSError:dlopen()无法加载库:cairo / cairo-2”
以下是所有细节:
;WITH cte
AS (SELECT CASE
WHEN val IS NOT NULL
AND Row_number()OVER(partition BY val ORDER BY ord) = 1 THEN val
ELSE NULL
END val,
ord
FROM Yourtable
CROSS apply (VALUES ([B11_1_siknr],1),([B11_2_siknr],2),([B12_siknr],3),([B21_siknr],4),
([B22_1_siknr],5),([B22_2_siknr],6),([B31_siknr],7),([B32_siknr],8),
([B41_siknr],9),([B42_siknr],10))tc (val, ord))
SELECT B11_1_siknr = [1],
B11_2_siknr = [2],
...
FROM cte
PIVOT (Max(val)
FOR ord IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10]))pv
我在Stackoverflow上找到了类似问题的解决方案:Getting "OSError: dlopen() failed to load a library: cairo / cairo-2" on Windows。正如那里所建议的那样,我从http://win32builder.gnome.org/下载了一个名为GTK + Bundle 3.10.4的软件包。我按照那里提到的说明。但仍然出现错误。
我还在这里找到了另一个可能的解决方案:dlopen() failed to load a library: cairo / cairo-2
我已在我的电脑中安装了Choco,并在命令提示符下运行了以下命令。
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0420DE40>
Traceback (most recent call last):
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Windows\SysWOW64\myshop\myshop\urls.py", line 25, in <module>
url(r'^orders/', include('orders.urls', namespace='orders')),
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Windows\SysWOW64\myshop\orders\urls.py", line 2, in <module>
from . import views
File "C:\Windows\SysWOW64\myshop\orders\views.py", line 7, in <module>
import weasyprint
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\weasyprint\__init__.py", line 375, in <module>
from .css import preprocess_stylesheet # noqa
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\weasyprint\css\__init__.py", line 29, in <module>
from . import computed_values
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\weasyprint\css\computed_values.py", line 16, in <module>
from .. import text
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\weasyprint\text.py", line 18, in <module>
import cairocffi as cairo
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cairocffi\__init__.py", line 41, in <module>
cairo = dlopen(ffi, 'cairo', 'cairo-2')
File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cairocffi\__init__.py", line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2
现在,我收到了这些错误:
choco install libcairo2
我完全陷入困境。请帮我。我正在做一个关于建立在线商店的Django课程。除非我解决这个问题,否则我无法继续。所以,我非常需要帮助。