Linux Snap7 wie Installiern

stiffler00b

Level-2
Beiträge
6
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo,
Benötige Hilfe bekomme Snap7 nicht richtig installiert.

habe es so installiert:
python3 -m pip install python-snap7

Bekomme immer wieder diesen Fehler
import snap7.util as util
ImportError: No module named 'snap7.util'; 'snap7' is not a package
 
Du hast mit python3 ja explizit zu Python Version 3 installiert.
Mit welcher Python-Version rufst du dein eigenes Programm denn auf? Evtl. verweist python noch auf die Version 2.

Du kannst dir ja mal die Version ausgeben lassen mit:
python --version
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Package Version
------------------------ ----------------------
alabaster 0.7.7
apt-clone 0.2.1
apt-xapian-index 0.47
apturl 0.5.2
Babel 1.3
blinker 1.3
Brlapi 0.6.4
chardet 2.3.0
command-not-found 0.3
cryptography 1.2.3
defer 1.0.6
dirspec 13.10
docutils 0.12
httplib2 0.9.1
idna 2.0
imutils 0.5.2
Jinja2 2.8
louis 2.6.4
lxml 3.5.0
Mako 1.0.3
MarkupSafe 0.23
numpy 1.16.2
oauthlib 1.0.3
onboard 1.2.0
oneconf 0.3.9
opencv-python 4.1.0.25
pexpect 4.0.1
Pillow 3.1.2
pip 19.1.1
piston-mini-client 0.7.5
psutil 3.4.2
ptyprocess 0.5
pyasn1 0.1.9
pycrypto 2.6.1
pycups 1.9.73
pycurl 7.43.0
Pygments 2.1
pygobject 3.20.0
PyICU 1.9.2
PyJWT 1.3.0
PyQt5 5.12.1
PyQt5-sip 4.19.15
python-apt 1.1.0b1+ubuntu0.16.4.2
python-debian 0.1.27
python-snap7 0.10
python-xapp 1.0.0
pytz 2014.10
pyxdg 0.25
reportlab 3.3.0
requests 2.9.1
roman 2.0.0
rope 0.14.0
scipy 1.2.1
sessioninstaller 0.0.0
setproctitle 1.1.8
setuptools 20.7.0
six 1.10.0
Sphinx 1.3.6
sphinx-rtd-theme 0.1.9
spyder 2.3.8
system-service 0.3
thin-client-config-agent 0.8
ubuntu-drivers-common 0.0.0
ufw 0.35
urllib3 1.13.1
virtkey 0.63.0
xkit 0.0.0
 
das hier habe ich auch noch mal versucht ohne Veränderung.



  1. [*=left]Download and unzip snap7-full-1.4.2
    [*=left]Compile the library
    [*=left]

    • [*=left]cd snap7-full-1.4.2/build/unix
      [*=left]sudo make -f x86_64_linux.mk


    [*=left]Copy the compiled library to lib directories
    [*=left]

    • [*=left]cd snap7-full-1.4.2/build/x86_64-linux
      [*=left]cp libsnap7.so /usr/lib
      [*=left]cp libsnap7.so /usr/local/lib


    [*=left]Install python-snap7 (pip install python-snap7)
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Je nachdem wie man die Pakete installiert, kann da einiges durcheinander kommen.
Es passiert z.B. ziemlich oft, dass jemand ein Paket installiert, aber für die falsche Python-Version.

Am besten legst du als erstes ein virtual environment an:
Code:
python3 -m venv my_venv
Das zweite Argument ist der Name des Verzeichnisses für das venv.

Dann musst du das venv aktivieren:
Code:
source my_venv/bin/activate

Nun kannst du pip direkt benutzen und die Pakete werden dann im venv installiert.

Code:
pip install python-snap7

Wenn man pip auaußerhalb eines venvs nutzt, werden die Pakete systemweit installiert.
Wenn man noch --user mit anhängt, werden die Pakete in ~/.local/ installiert.
Beides ist schlecht, da man recht wenig Kontrolle darüber hat, welches Script jetzt welchen Interpreter nimmt.

Du musst auch dran denken immer das virtuelle environment zu aktivieren, bevor du Code ausführst bzw. Pakete installierst.
 
Zurück
Oben