Как установить wxpython 4 Ubuntu 18.04
Я пытаюсь установить wxPython 4 на мою машину с Ubuntu 18.04.
sudo pip isntall wxpython
Я получаю это предупреждение первым
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
и в итоге ошибка
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-SyaTU1/wxpython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-bzIjlK/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-SyaTU1/wxpython/
У меня была похожая проблема с wxPython3, и решение было установить его с помощью get
sudo apt-get install python-wxgtk-3.0
Я также смог установить wxPython 4 для Python3, но не Python 2.7 ( инструкции)
Кроме того, я очень смущен, почему для установки wxpython требуется так много процессора
sudo pip install wxpython
3 ответа
После достаточно долгого ожидания процесс был завершен, и я установил wxPython 4.
бежать
sudo apt install make gcc libgtk-3-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python-gst-1.0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-devsudo pip install wxpythonподождите, пока он установится
после завершения вы увидите это сообщение.
The directory '/home/user-ii-6/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user-ii-6/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting wxpython
Downloading https://files.pythonhosted.org/packages/dd/31/bd55ab40e406a026a7fda0bb5eb61f466682544ae91ac26267c750f5e618/wxPython-4.0.3.tar.gz (68.5MB)
100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 68.5MB 929kB/s
Requirement already satisfied: six in ./.local/lib/python2.7/site-packages (from wxpython) (1.11.0)
Requirement already satisfied: PyPubSub in ./.local/lib/python2.7/site-packages (from wxpython) (4.0.0)
Requirement already satisfied: typing in ./.local/lib/python2.7/site-packages (from PyPubSub->wxpython) (3.6.6)
Installing collected packages: wxpython
Running setup.py install for wxpython ... done
Successfully installed wxpython-4.0.3
Поскольку существуют различные опции для дистрибутива и wx-порта (GTK2 или GTK3), тогда не все файлы могут быть расположены в одной папке для легкого доступа по pip. Это просто означает, что вам нужно немного углубиться в детали, чтобы найти URL-адрес для pip. Например, чтобы получить сборки GTK3 wxPython для Ubuntu 18.04 (и 16.10, LinuxMint 18 и, возможно, другие), вы можете использовать команду pip, например:
pip install -U \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \ wxPython
Конечно, вы всегда можете загрузить файл wheel самостоятельно, а затем использовать pip для установки вашей локальной копии файла.
Сначала я нашел это:
sudo apt search python3-wx
Я установил последний wxpython с:
sudo apt-get install python3-wxgtk4.0 python3-wxgtk-webview4.0 python3-wxgtk-media4.0
Вы также можете попробовать Synaptic установить его таким образом, если вы предпочитаете.
Если кто-нибудь исправил эту ошибку
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
попробуй это
sudo apt install make gcc libgtk-3-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python-gst-1.0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-dev
sudo apt-get install python-wxgtk3.0
