如何安装cython? [英] How can I install cython

查看:138
本文介绍了如何安装cython?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows上安装Kivy的过程中,我发现我需要Cython。




  • 我尝试使用 easy_install cython ,但是这会给出以下错误:错误:无法找到vcvarsall.bat

  • 我从Cython的官方页面下载了该软件包,但是当尝试运行 python setup.py install 时,我看到相同的错误。



    • 如何安装Cython?没有这个'vcvarsall.bat'错误。



      我正在运行Windows 32位。





      解决方案

      Cython是一个 binary 包。这意味着它不是完​​全用Python编写的。它的一部分是用于编译为本地二进制文件的语言,例如C或C ++。 vcvarsall.bat 是一个Microsoft脚本,用于调用C或C ++代码的编译器。换句话说,您的系统上没有安装编译器(或至少Python找不到)。



      您的选项包括:




      • 安装C / C ++编译器,确保Python可以找到并使用它

      • 查找预先构建的二进制这个图书馆



      后者将更简单。你可以在这里找到二进制文件: http://www.lfd.uci.edu/~gohlke/pythonlibs/ #cython 。下载对应于你的bitness和Python版本的二进制文件。例如,如果您使用的是Python 3.4,而您的系统是32位,则可以下载 Cython-0.21.1.win32-py3.4.exe 将其保存到您知道路径的位置。(一个简单的选择是将其保存到 C:\ 目录。)然后运行 easy_install 在下载的文件中,类似于:

        easy_install C: \Cython-0.21.1.win32-py3.4.exe 

      (确保更改该命令中的路径匹配实际的文件路径。)


      In the process of installing Kivy on Windows, I found that I needed Cython.

      • I tried installing it using easy_install cython, but this gave the following error: error: Unable to find vcvarsall.bat
      • I downloaded the package from Cython's official page, but when trying to run python setup.py install, I saw the same errors.

      How can I install Cython? Without this 'vcvarsall.bat' error.

      I am running Windows 32 bit.

      解决方案

      Cython is a binary package. This means it is not written entirely in Python. Part of it is in a language that compiles to native binaries, such as C or C++. vcvarsall.bat is a Microsoft script for calling a compiler for C or C++ code. In other words, you don't have a compiler installed on your system (or at least, Python can't find it).

      Your options include:

      • Install a C/C++ compiler and make sure Python can find and use it
      • Find a prebuilt binary of this library

      The latter will be simpler. You can find the binary here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython. Download the binary that corresponds to your bitness and Python version. For example, if you're using Python 3.4 and your system is 32-bit, you would download Cython‑0.21.1.win32‑py3.4.exe. Save this to a location where you know the path. (One simple choice is just saving it to the C:\ directory.) Then run easy_install on the downloaded file, similar to this:

      easy_install C:\Cython‑0.21.1.win32‑py3.4.exe
      

      (Make sure you change the paths in that command to match the actual file paths.)

      这篇关于如何安装cython?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆