ubuntu14.04環境下spyder的安裝

在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 + 模塊名

相關文章
相關標籤/搜索