问题描述
我使用的是Ubuntu 14.04。我安装了 pyenv
,然后在 pyenv
下安装了Python 3.4.2。然后我切换到版本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
现在我想安装 ipython
和 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']
然后我试过:
$ 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
更新
从上一条错误消息中我想我必须这样做
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
现在,当我跑步时:
$ 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
推荐答案
我想我找到了问题:
PySide构建显然需要一个python .. 3.4.so
共享库而不是静态( .a)图书馆参见):
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
然后安装 pyside
$ pip install pyside
然后安装 pygments
和 pyzmq
:
$ pip install pygments
$ pip install pyzmq
最后,你可以运行它:
$ pip install ipython
$ ipython qtconsole &
这篇关于如何使用pyenv安装ipython qtconsole(Python版本3.4.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!