Python Sass 无法加载 DLL

Python Sass unable to load DLL

在 Windows、Python 3.4 64 位。 安装了 libsass,但无法 运行 它。
可能与 32 位和 64 位有关。

pip install libsass
Requirement already satisfied (use --upgrade to upgrade): libsass in c:\python34\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): six in c:\python34\lib\site-packages (from libsass)

python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sass
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python34\lib\site-packages\sass.py", line 24, in 
from _sass import OUTPUT_STYLES, compile_filename, compile_string
ImportError: DLL load failed: %1 is not a valid Win32 application.

求助!

你应该只安装合适的轮子:https://pypi.python.org/pypi/libsass (libsass-0.8.3-cp34-none-win_amd64.whl)

我刚刚遇到了类似的错误:

      File "K:\Python27\lib\site-packages\sass.py", line 26, in <module>
      from _sass import OUTPUT_STYLES, compile_filename, compile_string
      ImportError: DLL load failed: The specified module could not be found.

经过大量搜索,在 Windows 上我似乎缺少所需的 C++,而且,作为 Windows,解决此问题的最简单方法是使用 C++ 更新 VisualStudio图书馆。

错误消失了,执行此操作后 libsass 运行良好。

    Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit(Intel)] on win32  Type "help", "copyright", "credits" or "license" for more information.
    >>> import sass
    >>> print sass.compile(string='a { b{ color: blue; } }')
     a b { color: blue; }

我知道它没有直接回答问题,但我想我会把我找到的解决方案留在这里,以供那些像我一样正在浪费几个小时的人使用。

我 Visual Studio 2013 - 安装了 Visual Studio Community 2015(确保 select C 和 C++ 库)

libsass DLL(python 世界中的“_sass.pyd”)可能遗漏了它的一些依赖项。

您只需安装小的 "Visual C++ Redistributable for Visual Studio 2015" 即可获得那一堆缺失的 C++ 组件。