Python 导入错误:没有名为 PySide 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27798829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 02:17:30  来源:igfitidea点击:

ImportError: No module named PySide

pythonpyside

提问by Unnikrishnan

I have installed PySide in my Ubuntu 12.04. When I try to use import PySide in the python console I am getting the following error.

我已经在我的 Ubuntu 12.04 中安装了 PySide。当我尝试在 python 控制台中使用 import PySide 时,出现以下错误。

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

My Python Path is :

我的 Python 路径是:

print sys.path ['', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

how to fix this problem ?

如何解决这个问题?

回答by rlacko

The latest build and install instructions for PySide are here:

PySide 的最新构建和安装说明在这里:

http://pyside.readthedocs.org/en/latest/building/linux.html

http://pyside.readthedocs.org/en/latest/building/linux.html

回答by cauchy

To use python 3, just follow the instructions here:

要使用 python 3,只需按照此处的说明操作:

https://wiki.qt.io/PySide_Binaries_Linux

https://wiki.qt.io/PySide_Binaries_Linux

which in ubuntu 12.04 means just typing one line in the console:

这在 ubuntu 12.04 中意味着只需在控制台中输入一行:

sudo apt-get install python3-pyside