python qt刷新,如何使用pyenv安装ipython qtconsole(Python版本3.4.2)

I am using Ubuntu 14.04. I installed pyenv and then installed Python 3.4.2 under pyenv. Then I switched to version 3.4.2:

$ pyenv global 3.4.2

Now I would like to install ipython and the qtconsole:

$ pip install ipython

$ ipython3 qtconsole &

This gives an error message (traceback not shown):

ImportError:

Could not load requested Qt binding. Please ensure that

PyQt4 >= 4.7 or PySide >= 1.0.3 is available,

and only one is imported per session.

Currently-imported Qt library: Noneu

PyQt4 installed: False

PySide >= 1.0.3 installed: False

Tried to load: ['pyside', 'pyqt']

Then I tried:

$ pip install pyside

which gives error (some parts of output removed):

Installing collected packages: pyside

Running setup.py install for pyside

Removing /tmp/pip_build_hakon/pyside/pyside_package

Python architecture is 64bit

Failed to locate a dynamic Python library, using /home/hakon/.pyenv/versions/3.4.2/lib/libpython3.4m.a

qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

Failed to query the Qt version with qmake /usr/bin/qmake

Update

From the previous error message I figured I had to do

$ sudo apt-get install qt4-qmake

And then I got some new error messages, which led me to run:

$ sudo apt-get install libxslt-dev

$ sudo apt-get install qt4-default

Now, when I run:

$ pip install pyside

I get error (first part of output cut out):

[ 83%] Building CXX object libshiboken/CMakeFiles/libshiboken.dir/shibokenbuffer.cpp.o

Linking CXX shared library libshiboken.cpython-34m.so

/usr/bin/ld: /home/hakon/.pyenv/versions/3.4.2/lib/libpython3.4m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC

/home/hakon/.pyenv/versions/3.4.2/lib/libpython3.4m.a: error adding symbols: Bad value

collect2: error: ld returned 1 exit status

解决方案

I think I found the problems:

The PySide build apparently needs a python ..3.4.so shared library and not a static (.a) library see http://qt-project.org/forums/viewthread/49955.

The solution was now to uninstall Python

$ pyenv uninstall 3.4.2

Then reinstall Python with shared library support (see also https://github.com/yyuu/pyenv/issues/82):

$ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.4.2

$ pyenv global 3.4.2

Then install pyside

$ pip install pyside

Then install pygments and pyzmq:

$ pip install pygments

$ pip install pyzmq

And finally, you can run it:

$ pip install ipython

$ ipython qtconsole &

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值