ow3n
ow3n

Reputation: 6597

Trouble installing pyserial with macports python (python27) on Mac

I installed py-serial using macports (on my mac) but it installed python24 instead of using my existing python27.

So if use the python24 that macports py-serial installed then I can import py-serial

# /opt/local/bin/python2.4 -c 'import serial'

But I cannot import it into python27 using either of these

# /opt/local/bin/python2.7 -c 'import serial'
# python -c 'import serial'

I get this error

Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named serial

I made sure I have the correct version selected:

# port select --set python python27

I tried uninstall and reinstall it still gives the same error as above

# sudo port uninstall
# port install py-serial

I think this is a problem related to my macports/python, not py-serial. Any help is appreciated.

Upvotes: 1

Views: 4100

Answers (1)

mmmmmm
mmmmmm

Reputation: 32681

py-serial is the port for python2.4 for later versions of python use the numbered version e.g.

sudo port install py27-serial

It is an historical error - originally they thought they should just have one version of python packages then it was realised that you could have multiple versions of python and that many packages are version dependant.

Upvotes: 5

Related Questions