Yuxiang Wang
Yuxiang Wang

Reputation: 8433

Cython with python 3.3

I have been using python 3.3

This is an old problem as I searched, and this is what I did:

helloworld.pyx

print("Hello world!")

Then, in ipython, I did:

import pyximport; pyximport.install()
import helloworld

It says:

ImportError: Building module helloworld failed: ["ValueError: ['path']\n"]

The same problem did not happen with python 2.7

I googled this: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows and realized that I have to install Windows SDK for Windows 7 and .NET Framework 4. As it comes with the VC++2010 Redistributables, I did not install the redistributables alone again. I thought I had everything ready, but the import error still remains.

Could anyone please help me solve it?

Thank you!

-Shawn

Upvotes: 4

Views: 1519

Answers (2)

ashkan
ashkan

Reputation: 166

install Windows 7 SDK, then open cmd run: "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64

then run: python setup.py install

Upvotes: 1

thengineer
thengineer

Reputation: 595

I was having the same issue and the same environment (win7 64bit, python-3.3.3 64bit).

I have

  1. installed the Windows 7 SDK as described on the wiki cython wiki as you did,
  2. applied the patch (msvccompiler9_33.diff) from this python bug,
  3. fixed the above patch by defining a missing variable as described here
  4. Installed MS Visual C++ Express 2010 (seems to be required)
  5. Updated the Windows 7 SDK to include the "Windows Headers and Libraries", "Tools" and of course the "Visual C++ Compilers" the MSVC++2010 redistributable.

And now I can compile and import the helloworld.py just fine.

Upvotes: 1

Related Questions