Setting up Cython

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DossarLX ODI
    Batch Manager
    Game Manager
    FFR Simfile Author
    • Mar 2008
    • 14989

    #1

    Setting up Cython

    I've been trying to do this for 4 hours and it's pissing me off to no end. I'll describe what the issues are.

    Cython is a Python package that allows python code to be compiled into C code so it can run faster.

    To clarify, I am using Windows 7.

    - I got Cython 0.20.1 (released 2014-02-11) from cython.org and unpacked it
    - I ran setup.py through IDLE and it put a bunch of other stuff in my Cython-0.20.1 folder (separate from the Python27 folder)
    - Added C:\python27;C:\MinGW\bin;C:\Cython-0.20.1 to PATH
    - I put a hello world program in my Cython folder and ran those from import statements and got:
    Code:
    Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import os
    >>> os.chdir( 'c:/Cython-0.20.1' )
    >>> from distutils.core import setup
    >>> from Cython.Build import cythonize
    >>> setup(
        ext_modules = cythonize("helloworld.pyx")
    )
    Compiling helloworld.pyx because it changed.
    Cythonizing helloworld.pyx
    Then I get to this step.
    Code:
    python setup.py build_ext --inplace
    I enter that into windows cmd and it does recognize python's interpreter because when I type python by itself it runs the interpreter in Python27. Then I get
    Code:
    > python setup.py build_ext --inplace
    python: can't open file 'setup.py': [Errno 2] No such file or directory
    So now I have a .pyx file and a .c file for helloworld, but I can't get a .dll like what the documentation says (Windows).

    Edit: Even worse, I don't even think it's set up properly, yet I have the cythonize stuff in the package.

    Code:
    > python setup.py install
    running install
    running build
    running build_py
    running build_ext
    building 'Cython.Plex.Scanners' extension
    C:\cygwin\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\python27\include -IC:\pyth
    on27\PC -c Cython\Plex\Scanners.c -o build\temp.win-amd64-2.7\Release\cython\ple
    x\scanners.o
    cygwin warning:
      MS-DOS style path detected: Cython\Plex\Scanners.c
      Preferred POSIX equivalent is: Cython/Plex/Scanners.c
      CYGWIN environment variable option "nodosfilewarning" turns off this warning.
      Consult the user's guide for more details about POSIX paths:
        http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    gcc: error: unrecognized command line option `-mno-cygwin'
    error: command 'gcc' failed with exit status 1


    Edit 2: Now I'm getting gcc errors on ld
    Code:
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    Last edited by DossarLX ODI; 03-15-2014, 08:23 AM.
    Originally posted by hi19hi19
    oh boy, it's STIFF, I'll stretch before I sit down at the computer so not I'm not as STIFF next time I step a file
Working...
    Notice: Function utf8_encode() is deprecated in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2 Notice: Function utf8_encode() is deprecated in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2 Warning: Undefined variable $username in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2 Notice: Function utf8_encode() is deprecated in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2 Notice: utf8_encode(): Passing null to parameter #1 ($string) of type string is deprecated in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2 Notice: Function utf8_encode() is deprecated in phar://.../vb/vb.phar/mail/transport/legacy.php on line 2