【问题标题】:Python Sass unable to load DLLPython Sass 无法加载 DLL
【发布时间】:2015-08-28 04:34:55
【问题描述】:

在 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.

救命!

【问题讨论】:

    标签: django python-3.x libsass


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

            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(确保选择 C ​​和 C++ 库)

      【讨论】:

      • 你能更新一下你是从哪个版本更新的吗?最终版本是什么?
      • 是的,很抱歉。我打字的时候很着急。我有 Visual Studio 2013,安装了 Visual Studio Community 2015(确保选择 C ​​和 C++ 库)
      【解决方案3】:

      libsass DLL(python 世界中的“_sass.pyd”)可能缺少一些依赖项。

      您只需安装小型“Visual C++ Redistributable for Visual Studio 2015”即可获得大量缺失的 C++ 组件。

      【讨论】:

        猜你喜欢
        • 2021-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-26
        • 2012-01-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多