1

When I compile a script using Cython, Python 3.6 is used to generate all the necessary files. How can one use a conda environment running Python version 3.5 to compile a Cython .pyx file on Windows?

5
  • Have you tried compiling it from within a sourced conda env? On windows to source your env: activate <your_env_name> Commented Oct 9, 2018 at 23:36
  • Yes, that's what I've been doing. It does not work. Unless I don't understand your suggestion correctly, that is not the solution. Commented Oct 9, 2018 at 23:45
  • "Doesn't work"--you're going to need to provide more information if you want help. What doesn't work? What exception are you getting? Commented Oct 10, 2018 at 0:15
  • "No module named 'script-name'". Also, the generated .pyd file is script-name.cp36-win_amd64.pyd. Notice the cp36 in the file name. Commented Oct 10, 2018 at 0:33
  • You need to share the code you're running and the stack trace you're getting please Commented Oct 10, 2018 at 3:53

1 Answer 1

1

I found the solution. I had accidentaly activated a different Python environment that uses Python version 3.6. Once I activated the right environment, I managed to compile and run my Cython-built program.

Sign up to request clarification or add additional context in comments.

1 Comment

This solution also worked for me on a MacOS by launching an app I know uses my specific python version. Tho wondering if there's a programatic or pythonic way of doing this within the venv project itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.