gpt4 book ai didi

python - 如何使用 pyenv 安装 ipython qtconsole(Python 版本 3.4.2)

转载 作者:行者123 更新时间:2023-11-30 23:15:40 26 4
gpt4 key购买 nike

我使用的是 Ubuntu 14.04。我安装了 pyenv,然后在 pyenv 下安装了 Python 3.4.2。然后我切换到3.4.2版本:

$ pyenv global 3.4.2

现在我想安装ipythonqtconsole:

$ pip install ipython
$ ipython3 qtconsole &

这给出了一条错误消息(未显示回溯):

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

这给出了错误(输出的某些部分被删除):

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

更新

根据之前的错误消息,我认为我必须这样做

$ sudo apt-get install qt4-qmake

然后我收到了一些新的错误消息,这导致我运行:

$ sudo apt-get install libxslt-dev
$ sudo apt-get install qt4-default

现在,当我运行时:

$ pip install pyside

我收到错误(输出的第一部分被删除):

[ 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) 库,请参阅 http://qt-project.org/forums/viewthread/49955 .

现在的解决方案是卸载Python

$ pyenv uninstall 3.4.2

然后重新安装具有共享库支持的 Python(另请参阅 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

然后安装pygmentspyzmq:

$ pip install pygments
$ pip install pyzmq

最后,您可以运行它:

$ pip install ipython
$ ipython qtconsole &

关于python - 如何使用 pyenv 安装 ipython qtconsole(Python 版本 3.4.2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28165637/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com