相关疑难解决方法(0)

错误:无法找到vcvarsall.bat

我试图安装Python包dulwich:

pip install dulwich
Run Code Online (Sandbox Code Playgroud)

但我得到一个神秘的错误信息:

error: Unable to find vcvarsall.bat
Run Code Online (Sandbox Code Playgroud)

如果我尝试手动安装包,也会发生同样的情况:

> python setup.py install
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
Run Code Online (Sandbox Code Playgroud)

python windows pip failed-installation setup.py

842
推荐指数
18
解决办法
87万
查看次数

如何告诉distutils使用gcc?

我想用Cython包装一个包含C++和OpenMP代码的测试项目,并通过setup.py文件使用distutils构建它.我的文件内容如下所示:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext


modules = [Extension("Interface",
                     ["Interface.pyx", "Parallel.cpp"],
                     language = "c++",
                     extra_compile_args=["-fopenmp"],
                     extra_link_args=["-fopenmp"])]

for e in modules:
    e.cython_directives = {"embedsignature" : True}

setup(name="Interface",
     cmdclass={"build_ext": build_ext},
     ext_modules=modules)
Run Code Online (Sandbox Code Playgroud)

-fopenmp标志与gcc一起用于编译和链接OpenMP.但是,如果我只是调用

cls ~/workspace/CythonOpenMP/src $ python3 setup.py build
Run Code Online (Sandbox Code Playgroud)

这个标志无法识别,因为编译器是clang:

running build
running build_ext
skipping 'Interface.cpp' Cython extension (up-to-date)
building 'Interface' extension
cc -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c Interface.cpp -o build/temp.macosx-10.8-x86_64-3.3/Interface.o …
Run Code Online (Sandbox Code Playgroud)

python distutils compiler-errors cython

53
推荐指数
3
解决办法
4万
查看次数