installed pyside but can't import it: "no module named pyside"

  • Last Update :
  • Techknowledgy :

When I run while in Python 3:

>>> print(sys.path)['', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/site-packages']

When I run while in Python 2:

>>> print sys.path['', '/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Suggestion : 2

ImportError: No module named pyasn1.codec.der? 2 , ImportError: No module named vidcap 2 ,Did you import it? Is PySide.py in the same directory as your main.py?, Python ImportError: No module named requests 6

Hi
When I run main.py I got this error how can I fix it?
I'm using https://github.com/PicciMario/iPhone-Backup-Analyzer-2

/
Traceback (most recent call last):
File "./main.py", line 44, in <module>
   from PySide import QtCore, QtGui
   ImportError: No module named PySide

If you have pip installed, check with ...

''
' modules_pip101.py
list all the installed modules
   ''
'

import pip

for item in pip.get_installed_distributions():
   print(item)

Check that this directory is in the python path

>>>
import sys
   >>>
   '/usr/lib/python2.7/dist-packages' in sys.path
True

If you have pip installed, check with ...

''
' modules_pip101.py
list all the installed modules
   ''
'

import pip

for item in pip.get_installed_distributions():
   print(item)

Check that this directory is in the python path

>>>
import sys
   >>>
   '/usr/lib/python2.7/dist-packages' in sys.path
True

You can also find PySide in a terminal with

sudo apt - get install mlocate
sudo updatedb
locate PySide
Traceback (most recent call last):
File "main.py", line 48, in <module>
   from main_window import Ui_MainWindow
   ImportError: No module named main_window

Suggestion : 3

 March 10, 2022     pyside, python     No comments   

When I run while in Python 3:

>>> print(sys.path)['', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/site-packages']

When I run while in Python 2:

>>> print sys.path['', '/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Suggestion : 4

I'm new to Python. I have both Python 2.7 and Python 3 installed. I just tried installing PySide via Homebrew and got this message:,This issue is that when I'm in either Python 2.7 or Python 3 and try to import PySide or run a test program that includes PySide, I get the message: "no module named PySide".,Both versions of Python and the newly installed PySide are all stored in /usr/local/Cellar/.,Python – Mac – Python – import error: “No module named site”

When I run while in Python 3:

>>> print(sys.path)['', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/site-packages']

When I run while in Python 2:

>>> print sys.path['', '/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Suggestion : 5

Both versions of Python and the newly anycodings_pyside installed PySide are all stored in anycodings_pyside /usr/local/Cellar/.,PySide package successfully installed in anycodings_pyside /usr/local/lib/python2.7/site-packages/PySide...,Why cant truffle be installed,Net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

When I run while in Python 3:

>>> print(sys.path)['', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/site-packages']

When I run while in Python 2:

>>> print sys.path['', '/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Suggestion : 6

sudo port install py-pyside succeeds but in Python import PySide gives "no module named PySide" , gives no errors; the module loads. It seems to me there is something broken specifically for pyside. , That's odd. First, /opt/local/bin is probably not at the beginning of your PATH environment variable if the system-installed version of python is found before the MacPorts version. However, if that directory doesn't exist, then "import PySide" wouldn't work either if you launched /opt/local/bin/python2.7. What is the output of this command?: , Right, my PATH was a real mess. All this time I thought macports installed python to /Library/Frameworks I'm going to fix this first, I think I will need to do quite a lot of reinstalling since many python modules are installed against a version I didn't want.

For example

import sip

here are some diagnostics

churchill: doc tim$ which python /
   Library / Frameworks / Python.framework / Versions / 2.7 / bin / python
churchill: doc tim$ port select--list python
Available versions
for python:
   none
python25 - apple
python26 - apple
python27(active)
python27 - apple

churchill: doc tim$ sudo port install python27
Password:
   -- - > Computing dependencies
for python27
-- - > Cleaning python27
-- - > Scanning binaries
for linking errors: 100.0 %
   -- - > No broken files found.

and an extract from port list instaled

py - pyside @1 .1 .2 python / py - pyside
py27 - cairo @1 .10 .0 python / py - cairo
py27 - distribute @0 .6 .35 python / py - distribute
py27 - distribute @0 .6 .35 python / py - distribute
py27 - gobject @2 .28 .6 python / py27 - gobject
py27 - libxml2 @2 .8 .0 python / py - libxml2
py27 - lxml @2 .3 .2 python / py - lxml
py27 - nose @1 .2 .1 python / py - nose
py27 - numpy @1 .6 .2 python / py - numpy
py27 - pygtk @2 .24 .0 python / py - pygtk
py27 - pyqt4 @4 .10 .0 python / py - pyqt4
py27 - pyside @1 .1 .2 python / py - pyside
py27 - shiboken @1 .1 .2 python / py - shiboken
py27 - sip @4 .14 .4 python / py - sip
python27 @2 .7 .3 lang / python27
python_select @0 .3 sysutils / python_select
qt4 - mac @4 .8 .4 aqua / qt4 - mac
qt4 - mac @4 .8 .4 aqua / qt4 - mac
rarian @0 .8 .1 textproc / rarian
readline @6 .2 .000 devel / readline

I have py27-pyside installed and cannot reproduce this. Does this directory exist?:

/opt/local / Library / Frameworks / Python.framework / Versions / 2.7 / lib / python2 .7 / site - packages / PySide

What is the output of this command?:

ls - l `which python`

See the FAQ about this. Please instead use:

port installed active

ls -l which python

churchill: python2 .7 tim$ ls - l `which python`
lrwxr - xr - x 1 root admin 7 23 Sep 22: 08 / Library / Frameworks / Python.framework / Versions / 2.7 / bin / python - > python2

That's odd. First, /opt/local/bin is probably not at the beginning of your PATH environment variable if the system-installed version of python is found before the MacPorts version. However, if that directory doesn't exist, then "import PySide" wouldn't work either if you launched /opt/local/bin/python2.7. What is the output of this command?:

port contents py27 - pyside