日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

ubuntu14.04环境下spyder的安装

發布時間:2025/3/15 Ubuntu 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubuntu14.04环境下spyder的安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉自:https://www.cnblogs.com/linhao-0204/p/5943910.html

在ubuntu14.04系統中,默認在/usr/lib目錄下安裝了python2.7.6和python3.4.3,在該環境下安裝spyder,然后使其鏈接到python3.4.3。

首先安裝為python3安裝模塊下載工具pip3,然后安裝spyder的依賴包PyQt5和sphinx。剛開始的時候直接安裝了PyQt4,然后會報錯,無法找到QT binding。

1,安裝pip3

參考:https://ft.wupo.info/pip3-python3-install-module/

sudo apt-get install python3-setuptools sudo easy_install3 pip

安裝完成pip3之后,就開始安裝spyder。

2,安裝spyder

參考:http://stackoverflow.com/questions/28518830/install-spyder-for-python3-4-ubuntu

但是這個鏈接里面的安裝是python-qt4和安裝后關聯的是python2,所以需要我們需要的版本是pyqt5,所以安裝python3-pyqt5,但該命令行只安裝了pyqt5的主要模塊,但在運行spyder的時候需要其他模塊,所以將其他模塊也進行安裝

sudo apt-get install python3-pyqt*

sudo apt-get install python3-pyqt5 python-sphinx sudo apt-get install python3-pyqt* sudo pip3 install spyder

3,一些問題

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

總結

以上是生活随笔為你收集整理的ubuntu14.04环境下spyder的安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。