| Reference | Downloads | Github

Psychopy can't run on mac due to versions conflict?



Hello. Could you help me to solve my problem? Thanks a lot.
I guess my problem is due to python versions conflict. The detail is as follows.


  • MacBook Air
  • OS:macOS Sierra 10.12.6

I already have the python 2.7.10 in my mac. It is the default version if I use the command line “python” to call python.
I also have python3.4 in my mac. It can be called by the command --“python3”.
When I use Psychopy, even I run a simple experiment (like display “text” for 1s), it goes wrong. The error message is:

######## Running: /Users/Duo/Desktop/new_task_WH_CE/ ########
Traceback (most recent call last):
File “soundfile.pyc”, line 142, in
OSError: sndfile library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/Users/Duo/Desktop/new_task_WH_CE/”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Applications/”, line 79, in
from . import backend_sounddevice as backend
File “/Applications/”, line 20, in
import soundfile as sf
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 646, in _load_unlocked
File “”, line 616, in _load_backward_compatible
File “soundfile.pyc”, line 156, in
File “posixpath.pyc”, line 78, in join
TypeError: expected str, bytes or os.PathLike object, not list

I went to check the files mentioned in the error messages. Then I found these code files declared “#!/usr/bin/env python” first. I guess it direct the python to the wrong version. In my case, it directs the python to the python2.7.
If I redirect the python from python2.7 to python3.6 built in the psychopy, I think the psychopy will work normally.
I tried to add the path of the python3.6 which is included in the psychopy as follow, but it didn’t work.


Could you help me to solve the problem? Thanks a lot.


This isn’t anything to do with there being other versions of Python installed. The standalone version of PsychoPy is exactly that: it stands alone, and contains its own version of Python, which is what will be used when you push the green “run” button. Try this:


I truly appreciate your help!
I changed it to [‘pyo’, u’sounddevice’, u’pygame’, ], it can work now!