ModuleNotFoundError: No module named 'Cython'

Question:

Why does Cython not want to work ? I’ve pip installed it and when I try to import it, it just won’t work.

I’m using MacOS Version 10.12.6 (16G29).

➡️ Desktop pip3 install Cython
Collecting Cython
Using cached https://files.pythonhosted.org/packages/e1/97/7e98410329c8a629d1.1de13377280a5b43bfcede6e05b95397609fae1f4c/Cython-0.29.3-cp37-cp37m-macosx.10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: Cython
Successfully installed [email protected]
➡️ Desktop
➡️ Desktop
➡️ Desktop
➡️ Desktop python3.7
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28)
[Clang 6.0 Cclang-600.0.57)] on darwin
Type “help”, “copyright”, “credits” or “License” for more information.
>>
>>
>>> import Cython
Traceback (most recent call last):
File "<stdiro", line 1, in <module>
ModuleNotFoundError: No module named "Cython*
>>
>>
>>> import cython
Traceback (most recent call last):
File "<stdiro", line 1, in <module>
ModuleNotFoundError: No module named ‘cython*
>>
Asked By: AymenTM

||

Answers:

This is possible if you have multiple versions of Python installed try:

python3.7 -m pip install cython

use which pip3 to check where it was installing the package previously


Update: OP used python3.7, if you have a different alias or a different version, you should use that instead. This is obviously installation dependent.

Answered By: Benoît P