2015-08-28 88 views
0

在Windows上,Python 3.4 64bit。 已安装libsass,但无法运行。
可能与32位和64位有关。Python Sass无法加载DLL

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. 

帮助!

回答

0

我刚刚经历了一场类似的错误:

 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 2015年社区(并确保选择C & C++库)(在Python世界 “_sass.pyd”)

+0

你可以更新从哪个版本更新,什么是最终版本? – prasun

+0

是的,很抱歉。当我打字的时候我很匆忙。我有Visual Studio 2013,安装了Visual Studio Community 2015(确保选择C&C++库) – KateJ

0

的libsass DLL可能会缺少一些依赖。

您只需安装小型“Visual C++ 2015的Visual C++可再发行组件”即可获得一堆缺少的C++组件。