在ubuntu14.04系统中,默认在/usr/lib目录下安装了python2.7.6和python3.4.3,在该环境下安装spyder,而后使其连接到python3.4.3。python
首先安装为python3安装模块下载工具pip3,而后安装spyder的依赖包PyQt5和sphinx
。刚开始的时候直接安装了PyQt4,而后会报错,没法找到QT binding。linux
1,安装pip3ubuntu
参考:https://ft.wupo.info/pip3-python3-install-module/app
sudo apt-get install python3-setuptools sudo easy_install3 pip
安装完成pip3以后,就开始安装spyder。python2.7
2,安装spyderide
参考:http://stackoverflow.com/questions/28518830/install-spyder-for-python3-4-ubuntu工具
可是这个连接里面的安装是python-qt4和安装后关联的是python2,因此须要咱们须要的版本是pyqt5,因此安装python3-pyqt5,但该命令行只安装了pyqt5的主要模块,但在运行spyder的时候须要其余模块,因此将其余模块也进行安装ui
sudo apt-get install python3-pyqt*spa
sudo apt-get install python3-pyqt5 sudo pip3 install spyderpython-sphinx
sudo apt-get install python3-pyqt*
3,一些问题.net
(1)在安装spyder过程当中出现如下问题:
error: command 'i686-linux-gnu-gcc' failed with exit status 1
参考http://blog.csdn.net/niyingxunzong/article/details/13094875
在终端输入:
sudo apt-get install python-dev
问题就解决了。
(2)输入spyder打开软件的时候,出现
pkg_resources.ContextualVersionConflict: (six 1.5.2 (/usr/lib/python3/dist-packages), Requirement.parse('six>=1.9.0'), {'prompt-toolkit'})
问题在于系统的six模块是1.5.2版本的,而运行spyder须要1.9.0版本,对six进行升级便可。
sudo pip3 install -U six
(3)关于PyQt版本的问题
在安装的过程当中,刚开始安装的是pyqt4的版本,此时在启动spyder出现错误,没法找到pyside,而后在处理该错误时又出现了没法找到QT连接的问题,这个问题的关键在于pyqt的版本问题,在python3.4的模块的安装目录下,即/usr/local/lib/python3.4/dist-packages/qtpy中能够找到出错的文件__init__.py,在该文件中能够看到说明
**QtPy** is a shim over the various Python Qt bindings. It is used to write Qt binding indenpendent libraries or applications. The shim will automatically select the first available API (PyQt5, PyQt4 and finally PySide). You can force the use of one specific bindings (e.g. if your application is using one specific bindings and you need to use library that use QtPy) by setting up the ``QT_API`` environment variable. PyQt5 ===== For PyQt5, you don't have to set anything as it will be used automatically:: >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PyQt4 ===== Set the ``QT_API`` environment variable to 'pyqt' before importing any python package:: >>> import os >>> os.environ['QT_API'] = 'pyqt' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PySide ====== Set the QT_API environment variable to 'pyside' before importing other packages:: >>> import os >>> os.environ['QT_API'] = 'pyside' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) """
QtPy主要是选择一个合适的QT binding,包括PyQt5,PyQt4和PySide,默认的是PyQt5,可是安装的版本是PyQt4,因此启动spyder会出错,上面的提示能够设置QT_API这个环境变量来选择版本,可是试验过以后仍然没法启动spyder,最后安装了PyQt5才解决该问题。
(4)python模块安装路径问题
目前有两个
usr/local/lib/python3.4/dist-packages/和usr/lib/python3/dist-packages/,这两个对应的都是python3模块的安装路径,模块安装方法有:
a,sudo apt-get install + 模块名
b,sudo pip3 install + 模块名