4

I have installed eventlet library in python using : pip install eventlet. But when I tried to import eventlet this error occured:

$python 
Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import eventlet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named eventlet

I tried to install it again but I got this :

$pip install eventlet
Requirement already satisfied (use --upgrade to upgrade): eventlet in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/eventlet-0.18.1-py3.5.egg
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.3 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/greenlet-0.4.9-py3.5-macosx-10.6-intel.egg (from eventlet)

How to rectify this error?

P.S : I am using Python 2.7

the_unknown_spirit
  • 2,518
  • 7
  • 34
  • 56

3 Answers3

5

This question is not specific to Eventlet, it's just about managing multiple versions of Python on OSX.

Your pip command installed eventlet into /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5, see version.

It means you actually have two Python versions installed: 2.7 and 3.5 and pip works with 3.5.

Your options:

  • (recommended) use separate virtualenv [1] for every project, explicitly specify python version when creating virtualenv using virtualenv --python=python2.7 /path/to/new/venv
  • run python3 and use eventlet in latest Python
  • run pip2 install eventlet
  • symlink pip to pip2 ln -snf $(which pip2) $(which pip)

[1] http://docs.python-guide.org/en/latest/dev/virtualenvs/

temoto
  • 5,394
  • 3
  • 34
  • 50
  • 1
    Also recommended, use a virtulenv to contain the python interpreter and packages http://docs.python-guide.org/en/latest/dev/virtualenvs/ – John Carter Feb 07 '16 at 09:32
  • @therefromhere yes, thank you, I inserted virtualenv option into my answer, it's really the best choice – temoto Feb 07 '16 at 09:38
0

You may also use

$py -2 -m pip install eventlet

It worked for me in Windows 10.

Jaimil Patel
  • 1,301
  • 6
  • 13
0
$pip install eventlet

This worked for me in windows10

devELIOper
  • 625
  • 5
  • 7