Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5758

Re: pip install /wo/anders ?

From "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de>
Newsgroups de.comp.lang.python
Subject Re: pip install /wo/anders ?
Date 2021-11-10 13:49 +0000
Message-ID <iv20voF1cf2U1@mid.individual.net> (permalink)
References <smg3dr$m0p$1@news2.informatik.uni-stuttgart.de>

Show all headers | View raw


Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:
>(OS ist Ubuntu 18.04)

>Mir gefaellt nicht, dass pip /usr/local/ vollkleistert, ich moechte das
>unter /opt/pip/ haben.

>Gefunden hab ich die --prefix Option, installieren klappt schon mal:

>root@moep:~# pip3 install --prefix /opt/pip PySimpleGUIDesigner
>Collecting PySimpleGUIDesigner
>  Using cached https://files.pythonhosted.org/packages/1e/bd/85cbde9056876f0d74889236fe2f3a2083d40bf807f10dadab774b989e0a/PySimpleGUIDesigner-0.1.4.7-py3-none-any.whl
>Requirement already satisfied: PySide2>=5.13 in /usr/local/lib/python3.6/dist-packages (from PySimpleGUIDesigner)
>Requirement already satisfied: PySimpleGUI in /usr/local/lib/python3.6/dist-packages (from PySimpleGUIDesigner)
>Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.6/dist-packages (from PySimpleGUIDesigner)
>Requirement already satisfied: shiboken2==5.15.2 in /usr/local/lib/python3.6/dist-packages (from PySide2>=5.13->PySimpleGUIDesigner)
>Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from click>=7.0->PySimpleGUIDesigner)
>Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from importlib-metadata; python_version < "3.8"->click>=7.0->PySimpleGUIDesigner)
>Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata; python_version < "3.8"->click>=7.0->PySimpleGUIDesigner)
>Installing collected packages: PySimpleGUIDesigner
>Successfully installed PySimpleGUIDesigner-0.1.4.7

>root@moep:~# du /opt/pip
>             64 /opt/pip/lib/python3.6/site-packages/PySimpleGUIDesigner/__pycache__
>            208 /opt/pip/lib/python3.6/site-packages/PySimpleGUIDesigner
>             28 /opt/pip/lib/python3.6/site-packages/PySimpleGUIDesigner-0.1.4.7.dist-info
>            236 /opt/pip/lib/python3.6/site-packages
>            236 /opt/pip/lib/python3.6
>            236 /opt/pip/lib
>              4 /opt/pip/bin
>            240 /opt/pip

>Aber wie geht dann uninstall?

>root@moep:~# pip3 uninstall --prefix /opt/pip PySimpleGUIDesigner

>Usage:
>  pip uninstall [options] <package> ...
>  pip uninstall [options] -r <requirements file> ...

>no such option: --prefix


>Auch der Aufruf klappt nicht:

>framstag@moep:~: /opt/pip/bin/PySimpleGUIDesigner 
>Traceback (most recent call last):
>  File "/opt/pip/bin/PySimpleGUIDesigner", line 7, in <module>
>    from PySimpleGUIDesigner.main import cli
>ModuleNotFoundError: No module named 'PySimpleGUIDesigner'

pip kennt nur die Standardorte für Packages. Wenn du andere Verzeichnisse
verwendest, musst du das Python über die Environvariable PYTHONPATH 
mitteilen.

Beispiel:
pip3 install --prefix=$HOME/jodel PySimpleGUIDesigner

Zum Deinstallieren:
PYTHONPATH=$HOME/jodel/lib/python3.7/site-packages/ pip3 uninstall PySimpleGUIDesigner
Uninstalling PySimpleGUIDesigner-0.1.4.7:
  Would remove:
    /localhome/ph/jodel/bin/PySimpleGUIDesigner
    /localhome/ph/jodel/lib/python3.7/site-packages/PySimpleGUIDesigner-0.1.4.7.dist-info/*
    /localhome/ph/jodel/lib/python3.7/site-packages/PySimpleGUIDesigner/*
Proceed (y/n)? y
  Successfully uninstalled PySimpleGUIDesigner-0.1.4.7

pip wird dich auch darauf hingewiesen haben, daß es Binaries und Skripten
in $prefix/bin installiert hat und dieses Verzeichnis nicht in $PATH ist.
Das musst du also ebenfalls anpassen.

Für dein Problem mit dem Dateiauswahldialog scheint es übrigens keine 
einfache und schöne Lösung zu geben. Die Klasse tkinter.filedialog.FileDialog
hat kein natives Look and Feel wie filedialog.askopenfilename().
In tk gibt es nur entweder Dateiauswahl oder Verzeichnisauswahl und 
PySimpleGUI ruft nur die von tk zur Verfügung gestellten Funktionen auf.
Du müsstest also deinen Fileselector komplett neu schreiben. Am einfachsten
scheint mir dabei die Verwendung von tkinter.ttk.Treeview.
Ob ein anderes Toolkit, z.B. gtk, einen passenden Dialog bietet, kann ich
nicht sagen. Tkinter hat aber den Vorteil, daß es bei Python unter allen
Plattformen verfügbar ist.

-- 
Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

pip install /wo/anders ? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2021-11-10 09:29 +0000
  Re: pip install /wo/anders ? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2021-11-10 13:49 +0000
    Re: pip install /wo/anders ? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2021-11-10 16:49 +0000
      Re: pip install /wo/anders ? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2021-11-11 08:04 +0000
        Re: pip install /wo/anders ? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2021-11-11 10:15 +0000
          Re: pip install /wo/anders ? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2021-11-11 12:09 +0000

csiph-web