Я хочу построить рисунок matplotlib в виртуальной среде Python, расположенной в папке TMPFS , которая была создана UV , но не может.
Это то, что я сделал:
Шаг 1:
$ mkdir /dev/shm/test
$ cd /dev/shm/test
$ uv init --python 3.13 --cache-dir .cache
$ uv add matplotlib
Примечание: я использовал-cache-dir .cache для решения проблемы кэша, связанного с использованием UV для добавления пакета (ы) в папку, которая находится в файловой системе, отличной от файловой системы, где UV установлен в Promition
. /> В той же файловой системе, что и в среде Python, UV работает. Он содержит: < /p>
import matplotlib.pyplot as plt
def main():
plt.figure()
x = [2, 4, 6, 8]
y = [10, 3, 20, 4]
plt.plot(x, y)
plt.show()
if __name__ == "__main__":
main()
Шаг 3: запустить main.py из виртуальной среды в TMPFS/Ramdisk.
$ source .venv/bin/activate
(test) $ python main.py
/dev/shm/test/main.py:15: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
plt.show()
matplotlib Рисунок просто не будет построить. Я не знаю, как решить эту проблему.$ uv add PyQt5 --cache-dir .cache
< /code>
и < /p>
$ uv add PyQt6 --cache-dir .cache
< /code>
отдельно. Тем не менее, они все еще не могут решить проблему. < /P>
(test) $ python main.py
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
Я также заметил, что tkinter не будет работать с помощью UV установлен Python.
(test) $ python -m tkinter
[xcb] Unknown sequence number while appending request
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
python: ../../src/xcb_io.c:157: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
Aborted (core dumped)
Подробнее здесь: https://stackoverflow.com/questions/795 ... fs-ramdisk
Как показать фигуру Matplotlib, которая добавляется UV на TMPFS/Ramdisk? ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Максимальная пропускная способность, которую мы можем достичь, написав в один файл на TMPFS
Anonymous » » в форуме Linux - 0 Ответы
- 9 Просмотры
-
Последнее сообщение Anonymous
-