简体   繁体   中英

How To: Install Spyder (Python IDE) on CentOS 6.4

I've been spending the past few days trying to install Spyder (the Python IDE) on CentOS 6.4. There are a couple of issues with installing Spyder on CentOS 6.4: the Qt RPM package does not include QtWebKit and the default install of Python is 2.6.6 rather that 2.7.4. These (and other) issues caused me problems which I was unable to find instructions for, so once I figured it out I decided to let others know.

So without further adieu:

How to Install Spyder (Python IDE) in CentOS 6.4

  1. Install PyQt4 from the RPM
  2. Install Distribute (easy_install fork) by downloading the script found here and running it via sudo python distribute_setup.py
  3. Install pip via sudo easy_install pip
  4. Install qt-mobility by downloading the .rpm from here . This installs dependencies required fro the next step.
  5. Install qtwebkit from here .
  6. Install PyQt4-webkit from here .
  7. Install Spyder using pip: sudo pip install spyder
  8. Run Spyder by typing spyder into a terminal or by selecting Spyder from the Applicaions -> Programming menu.

The following packages are highly recommended for Spyder. Install them using sudo pip install <package>

  • rope (code completion and definitions)
  • pyflakes (realtime code analysis / error checking)
  • pylint (code analysis)
  • pep8 (style analysis)
  • psutil (cpu/memory monitor)

The following packages are highly recommended for general Python development. Install them using sudo pip install <package>

Note: Do not install IPython. It requires Python 2.7 whereas the default python installation in CentOS6 is Python 2.6.6. IPython works with Python 2.6, but Spyder has a small bug where it will not load with IPython 0.13.2 and Python 2.6.6.

If anyone finds anything wrong with these instructions, please respond so I can update them.

Thanks!

Question:

How do I install PyQT4, qt-mobility, qtwebkit, PyQt4-webkit for python2.7 on centos 6.4 (remember python2.6 is the system default)?

I used the "Add/Remove Software" gui to install the requirements of 1, 4, 5, 6 and have found why you installed from the rpms...

using the "Add/Remove Software" gui, my PyQT4 installed for python2.6 /usr/lib64/python2.6/site-packages/PyQt4 when I am using python2.7

I am running python 2.7 and therefore the requirements.py does not see PyQT4 installed in the python2.7/site-packages directory instead it is at python2.6/site-packages I left my wrong steps at the bottom to show what not to do...

Thanks for the walkthrough! Appreciate the time you took to write this

Correct steps? (I think so...)

  • install SIP using python2.7 interpreter
  • install PyQT4 using python2.7 interpreter
  • install qt-mobility (is it oblivious to 2.6 or 2.7?)
  • install qtwebkit (is it oblivious to 2.6 or 2.7?)
  • install PyQt4-webkit (think its oblivious to 2.6 or 2.7)

Install SIP

I initially started at SIP's source because PyQT4 needs it and after reading the README felt unsure about the SIP source install as it said use build.py and it wasn't there. I looked at pypi and its there https://pypi.python.org/pypi/SIP/4.14.7 apparently pip has the same issue I had after reading the README

    sudo /usr/local/bin/pip install SIP
    Downloading/unpacking SIP
      Downloading sip-4.15-snapshot-972540270afa.zip (856kB): 856kB downloaded
      Running setup.py egg_info for package SIP
        Traceback (most recent call last):
          File "<string>", line 16, in <module>
        IOError: [Errno 2] No such file or directory: '/tmp/pip-build-root/SIP/setup.py'
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):

      File "<string>", line 16, in <module>

    IOError: [Errno 2] No such file or directory: '/tmp/pip-build-root/SIP/setup.py'

    ----------------------------------------
    Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/SIP
    Storing complete log in /root/.pip/pip.log

Eventually install PyQT4

cd to downloaded source directory of PyQt-x11-gpl-4.10.2

    /usr/local/bin/python2.7 configure-ng.py
    make
    sudo make install

PyQt4-webkit

when I jumped ahead and attempted to install the rpm "PyQt4-webkit", it said it was already installed probably due to my yum commands below. But is that for python2.6? I don't have it installed for python2.7....

Wrong steps that installed steps 1, 4, 5, and 6 for python 2.6

search in "Add/Remove Software" gui

  • PyQt4 -> PyQT-4.6.29.el6 (x86_64)
  • qt-mobility -> qt-mobility-1.1.3-2.el6 (x86_64)
  • qtwebkit -> qtwebkit-2.1.1-1.el6 (x86_64)

Or equivalent

    sudo yum install PyQt4.x86_64
    sudo yum install qt-mobility.x86_64
    sudo yum install qtwebkit.x86_64

_

extra for future readers dealing with python2.7 and python2.6 dual installs...

when using pip make sure to use it for python2.7

    pip --version

make sure it points to python2.7/site-packages/pip-version location and not the 2.6

I have to provide the absolute path because I haven't configured it in my sudo path...

    sudo /usr/local/bin/pip install spyder
    sudo /usr/local/bin/pip install rope
    sudo /usr/local/bin/pip install pyflakes
    sudo /usr/local/bin/pip install pylint
    sudo /usr/local/bin/pip install pep8
    sudo /usr/local/bin/pip install psutil

Well I answered it in the post. Oops.

this install guide is for python 2.6 [default python installation] on centos 6.4

this install guide is not for python 2.7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM