我正在运行 Ubuntu 16.04.5 LTS。
之前我安装了重新文本来自官方存储库的编辑器(版本 5.3.1-1)。我使用以下命令删除了此版本:
sudo apt-get purge retext
sudo apt-get autoremove
现在我想从 pip3 获取最新版本:
sudo apt install python3-pip
sudo pip3 install ReText
安装成功结束。但如果尝试使用 - 从终端启动 ReText retext
,我会得到:
$ retext
Traceback (most recent call last):
File "/usr/local/bin/retext", line 26, in <module>
from ReText import datadirs, settings, globalSettings, app_version
File "/usr/local/lib/python3.5/dist-packages/ReText/__init__.py", line 24, in <module>
from PyQt5.QtCore import QByteArray, QLocale, QSettings, QStandardPaths
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices
如何解决这个问题?
系统信息:
$ pip3 --version
pip 18.0 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
$ python3 --version
Python 3.5.2
$ which python3
/usr/bin/python3
$ dpkg -S /usr/bin/python3
python3-minimal: /usr/bin/python3
$ pip3 list --user
$ pip3 list
Package Version
---------------------------- ----------------------
alabaster 0.7.11
apparmor 2.10.95
apparmor.click 0.3.13.1
apt-xapian-index 0.47
apturl 0.5.2
argcomplete 1.9.4
asn1crypto 0.24.0
astroid 2.0.4
Babel 2.6.0
backcall 0.1.0
beautifulsoup4 4.6.3
bleach 2.1.4
Brlapi 0.6.4
cairocffi 0.9.0
certifi 2018.8.24
cffi 1.11.5
chardet 3.0.4
checkbox-ng 1.0.0
checkbox-support 0.38.0
click 6.7
cloudpickle 0.5.6
command-not-found 0.3
cryptography 2.3.1
cycler 0.10.0
decorator 4.3.0
defer 1.0.6
defusedxml 0.5.0
devscripts 1.0.0
docutils 0.14
ecdsa 0.13
entrypoints 0.2.3
esptool 2.5.0
guacamole 0.9.2
html5lib 1.0.1
idna 2.7
imagesize 1.1.0
indicator-cpufreq 0.2.2
ipykernel 4.9.0
ipython 6.5.0
ipython-genutils 0.2.0
isort 4.3.4
jedi 0.12.1
jeepney 0.3.1
Jinja2 2.10
jsonschema 2.6.0
jupyter-client 5.2.3
jupyter-core 4.4.0
keyring 15.1.0
kiwisolver 1.0.1
language-selector 0.1
lazy-object-proxy 1.3.1
LibAppArmor 2.10.95
lightdm-gtk-greeter-settings 1.2.1
louis 2.6.4
lxml 4.2.5
Magic-file-extensions 0.2
Mako 1.0.7
Markdown 2.6.11
Markups 3.0.0
MarkupSafe 1.0
mate-tweak 3.5.10
matplotlib 2.2.3
mccabe 0.6.1
mistune 0.8.3
nbconvert 5.4.0
nbformat 4.4.0
nose 1.3.7
notify2 0.3.1
numexpr 2.6.8
numpy 1.15.1
numpydoc 0.8.0
onboard 1.2.0
packaging 17.1
padme 1.1.1
pandas 0.23.4
pandocfilters 1.4.2
parso 0.3.1
pep8 1.7.1
pexpect 4.6.0
pickleshare 0.7.4
Pillow 5.2.0
pip 18.0
plainbox 0.38.0
ply 3.11
progressbar 2.5
prompt-toolkit 2.0.4
psutil 5.4.7
ptyprocess 0.6.0
pyaes 1.6.1
pyasn1 0.4.4
pycairo 1.17.1
pycodestyle 2.4.0
pycparser 2.18
pycrypto 2.6.1
pycups 1.9.73
pycurl 7.43.0.2
pyflakes 2.0.0
Pygments 2.2.0
PyGObject 3.30.1
pylint 2.1.1
PyOpenGL 3.1.0
pyparsing 2.2.0
PyQt5 5.11.2
PyQt5-sip 4.19.12
pyserial 3.4
python-apt 1.1.0b1+ubuntu0.16.4.2
python-dateutil 2.7.3
python-dbusmock 0.18
python-debian 0.1.33
python-gnupg 0.4.3
python-markdown-math 0.6
python-systemd 231
pytz 2018.5
pyxdg 0.26
PyYAML 3.13
pyzmq 17.1.2
QtAwesome 0.4.4
qtconsole 4.4.1
QtPy 1.5.0
reportlab 3.5.6
requests 2.19.1
requests-unixsocket 0.1.5
ReText 7.0.3
roman 3.0
rope 0.11.0
scipy 1.1.0
screen-resolution-extra 0.0.0
SecretStorage 3.1.0
selenium 3.14.0
sessioninstaller 0.0.0
setuptools 40.3.0
simplegeneric 0.8.1
sip 4.19.8
six 1.11.0
snowballstemmer 1.2.1
Sphinx 1.8.0
sphinx-rtd-theme 0.4.1
sphinxcontrib-websupport 1.1.0
spyder 3.3.1
spyder-kernels 1.1.0
ssh-import-id 5.6
system-service 0.3
tables 3.4.4
testpath 0.3.1
tornado 5.1.1
traitlets 4.3.2
typed-ast 1.1.0
ubuntu-drivers-common 0.0.0
Ubuntu-Make 18.5
ufw 0.35
urllib3 1.23
urwid 2.0.1
usb-creator 0.3.0
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.31.1
wrapt 1.10.11
xcffib 0.6.0
xdiagnose 3.8.4.1
xkit 0.0.0
XlsxWriter 1.1.0
$ dpkg -l | grep python3- | grep ^ii | awk '{print $2}'
ipython3-qtconsole
libpython3-all-dev:amd64
libpython3-dev:amd64
libpython3-stdlib:amd64
python3-alabaster
python3-all
python3-all-dev
python3-apparmor
python3-apparmor-click
python3-apport
python3-apt
python3-aptdaemon
python3-aptdaemon.gtk3widgets
python3-aptdaemon.pkcompat
python3-argcomplete
python3-babel
python3-brlapi
python3-bs4
python3-cairo
python3-cairocffi
python3-cffi
python3-cffi-backend
python3-chardet
python3-checkbox-ng
python3-checkbox-support
python3-click-package
python3-commandnotfound
python3-cups
python3-cupshelpers
python3-cycler
python3-dateutil
python3-dbus
python3-dbus.mainloop.qt
python3-dbusmock
python3-debian
python3-decorator
python3-defer
python3-dev
python3-distupgrade
python3-docutils
python3-gdbm:amd64
python3-gi
python3-gi-cairo
python3-gnupg
python3-gst-1.0
python3-guacamole
python3-html5lib
python3-jedi
python3-jinja2
python3-libapparmor
python3-louis
python3-lxml
python3-magic
python3-mako
python3-markupsafe
python3-matplotlib
python3-minimal
python3-newt
python3-nose
python3-notify2
python3-numexpr
python3-numpy
python3-packagekit
python3-padme
python3-pandas
python3-pandas-lib
python3-pep8
python3-pexpect
python3-pil:amd64
python3-pip
python3-pkg-resources
python3-plainbox
python3-ply
python3-problem-report
python3-progressbar
python3-psutil
python3-ptyprocess
python3-pyasn1
python3-pyatspi
python3-pycparser
python3-pycurl
python3-pyflakes
python3-pygments
python3-pyparsing
python3-pyqt4
python3-pyqt5
python3-pyqt5.qtsvg
python3-pyqt5.qtwebkit
python3-renderpm:amd64
python3-reportlab
python3-reportlab-accel:amd64
python3-requests
python3-roman
python3-scipy
python3-selenium
python3-setuptools
python3-simplegeneric
python3-sip
python3-six
python3-software-properties
python3-speechd
python3-sphinx
python3-sphinx-rtd-theme
python3-systemd
python3-tables
python3-tables-lib
python3-tk
python3-tz
python3-uno
python3-update-manager
python3-urllib3
python3-wheel
python3-xapian1.3
python3-xcffib
python3-xdg
python3-xkit
python3-xlsxwriter
python3-yaml
python3-zmq
$ dpkg -S /usr/lib/python3/dist-packages | sed 's/, /\n/g'
python3-libapparmor
python3-aptdaemon.pkcompat
python3-aptdaemon
ubuntu-system-service
python3-cairo
python3-bs4
python3-apparmor-click
python3-renderpm:amd64
python3-pyqt5.qtsvg
python3-pycparser
python3-pyatspi
python3-pyasn1
python3-progressbar
python3-problem-report
python3-pexpect
python3-numexpr
python3-matplotlib
python3-packagekit
python3-numpy
python3-nose
python3-jedi
python3-gst-1.0
python3-decorator
python3-cups
python3-checkbox-support
python3-checkbox-ng
python3-plainbox
python3-chardet
python3-cairocffi
language-selector-gnome
ufw
python3-distupgrade
python3-dbus
python3-update-manager
python3-gi
python3-tables-lib
python3-setuptools
python3-roman
python3-requests
python3-reportlab
python3-pyqt5
python3-sip
python3-sphinx-rtd-theme
python3-sphinx
software-properties-common
python3-selenium
python3-reportlab-accel:amd64
python3-pyqt4
python3-pygments
python3-pyflakes
python3-pycurl
python3-pkg-resources
python3-pep8
python3-pandas-lib
python3-ply
python3-pil:amd64
python3-ptyprocess
python3-pandas
python3-padme
python3-notify2
ssh-import-id
sessioninstaller
python3-speechd
python3-scipy
python3-newt
python3-mako
xdiagnose
ubuntu-drivers-common
python3-xapian1.3
python3-wheel
python3-urllib3
python3-tz
python3-software-properties
python3-six
python3-simplegeneric
python3-pyqt5.qtwebkit
python3-pyparsing
python3-psutil
usb-creator-gtk
update-manager
ubuntu-make
python3-uno
apturl
apt-xapian-index
python3-commandnotfound
python3-apt
python3.5
lsb-release
language-selector-common
debconf
python3-alabaster
usb-creator-common
python3-tables
python3-systemd
python3-magic
python3-louis
python3-defer
python3-brlapi
python3-aptdaemon.gtk3widgets
indicator-cpufreq
software-properties-kde
software-properties-gtk
screen-resolution-extra
python3-zmq
python3-yaml
python3-xlsxwriter
python3-xkit
python3-xdg
python3-xcffib
python3-markupsafe
python3-lxml
python3-jinja2
python3-dbusmock
python3-click-package
python3-html5lib
python3-guacamole
python3-gnupg
python3-gi-cairo
python3-docutils
python3-debian
python3-dbus.mainloop.qt
python3-dateutil
python3-cycler
python3-cupshelpers
python3-cffi
python3-cffi-backend
python3-argcomplete
gir1.2-unity-5.0:amd64
devscripts
blueman
python3-babel
gir1.2-ibus-1.0:amd64
apturl-common
gnome-orca
python3-apport
onboard
mate-tweak
lightdm-gtk-greeter-settings
ipython3-qtconsole
ipython3
hplip
gir1.2-dee-1.0
python3-pip
python3-apparmor: /usr/lib/python3/dist-packages
答案1
非常奇怪的问题。我今天用同样的方法在其他 Ubuntu 16.04.5 笔记本电脑上安装了 ReText。
问题是由于我在pip3
前段时间在第一个系统上安装了,而今天在第二个系统上安装了pip3
。因此在第二个系统上pip3
下载了所有 python 包的最新版本。
在第一个系统上我安装了 Spyder,它需要 Qt5(但版本较低 - pyqt5<5.10),因此 ReText 在这里安装并运行没有问题。
解决方案是将 Spyder 重新安装到较低版本的 Qt5(5.9.2)python-packages:
sudo pip3 install spyder
此后 ReText 正常工作:
因此我理解了这种 Python 依赖地狱是如何以及为何发生的:)