This question already has an answer here:
Basically, I am trying to have a good python development environment for sckit image and sklearn.
However, it seems to me the python version that runs in the emacs environment is different than the one in the system.
The main issue being certain libraries seem to be missing from the version on emacs when running this code
from skimage.viewer import ImageViewer image = data.coins() viewer = ImageViewer(image) viewer.show()
I get these errors.
>>> Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/mods/Work/DR_Research/sample/imageProc.py", line 9, in <module> viewer = ImageViewer(image) File "/Library/Python/2.7/site-packages/skimage/viewer/viewers/core.py", line 194, in __init__ init_qtapp() File "/Library/Python/2.7/site-packages/skimage/viewer/utils/core.py", line 29, in init_qtapp QApp = QtWidgets.QApplication.instance() AttributeError: 'QtGui_cls' object has no attribute 'QApplication'
I have tried setting all sorts of variables from in the init-file py-shell interpreter, py-shell command, python-python command. I have tried appending the $PATH. All to no avail always the same version python 2.7.6 is being used in emacs
The same code runs normally on the os terminal. I only guessed that the different versions are the cause of the issue but it may be something else. I am kind of an amateur in python so detailed explanation is appreciated
Output of which python in os terminal
which python /usr/local/bin/python
Python related stuff in init file
(setq python-python-command "/usr/local/bin/python") (require 'python-mode) ;; (setq-default py-shell-name "/usr/local/bin/python") ;; (setq python-shell-interpreter "/usr/local/bin/python") (setq py-force-py-shell-name-p t) ; switch to the interpreter after executing code (setq py-shell-switch-buffers-on-execute-p t) (setq py-switch-buffers-on-execute-p t) ; don't split windows (setq py-split-windows-on-execute-p nil) ; try to automagically figure out indentation (setq py-smart-indentation t)