在Windows上,Python 3.4 64位。已安装libsass,但无法运行。
可能与32位和64位有关。
pip install libsass
Requirement already satisfied (use --upgrade to upgrade): libsass in c:python34libsite-packages
Requirement already satisfied (use --upgrade to upgrade): six in c:python34libsite-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:Python34libsite-packagessass.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)安装相应的wheel
我刚刚遇到了一个类似的错误:
File "K:Python27libsite-packagessass.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++库)
libsass DLL ("_sass. DLL ")Pyd(在python世界中)可能错过了它的一些依赖项。
你可以安装小的"Visual c++ Redistributable for Visual Studio 2015"来获得一堆缺失的c++组件。