Majid Rahimpour
Majid Rahimpour

Reputation: 309

Python - socketio import error

I installed python-socketio by this command :

sudo apt-get install python-socketio

But when I want to import it in my program, it has some error :

>>> from socketio import SocketIO
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from socketio import SocketIO
ImportError: No module named 'socketio'

What is the problem and how can I solve it ?

Upvotes: 9

Views: 24178

Answers (2)

Akash Kandpal
Akash Kandpal

Reputation: 3366

The following code can be used ::

sudo apt update
sudo apt install python-socketio

Upvotes: 1

Goddard
Goddard

Reputation: 3059

If you want to install socketio you have to use pip.

I like to use python 3 so I use this command in Ubuntu.

sudo -H pip3 install python-socketio

If you want to use default python which is probably set as to python2 use.

sudo -H pip install python-socketio

Also if you type pip and then hit tab twice in a row it will show all the different version you have available. For example my output looks like this.

pip         pip2        pip2.7      pip3        pip3.5      pip-review

Upvotes: 14

Related Questions