Wednesday 22 November 2017

Install Python 3 Packets

By default if you install something by
      pip install some_packet
I got the packet in Python 2.7 installed.

But if a packet, say pyusb, is a dependent to another packet that has be on Python 3, say pystlink, I will get:

Traceback (most recent call last):
  File "pystlink.py", line 4, in <module>
    import lib.stlinkusb
  File "/home/boris/Softwares/EmbeddedSystem/pystlink/pystlink-master/lib/stlinkusb.py", line 1, in <module>
    import usb.core
ImportError: No module named 'usb'

If I try to go to Python 3 and import usb, I would get the same output. Therefore, I need to install pyusb in Python 3 and here is how.

sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME

ref:
https://stackoverflow.com/questions/10763440/how-to-install-python3-version-of-package-via-pip-on-ubuntu

No comments:

Post a Comment