Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1579

Python • Re: Problems with venv

$
0
0
Have you activated the venv before running the python script?

Here, it fails if I do not activate the venv

Code:

python pub.pyTraceback (most recent call last):  File "/home/pi/myenv/pub.py", line 1, in <module>    import paho.mqtt.publish as publishModuleNotFoundError: No module named 'paho'
but works if I activate it first

Code:

pi@pibk:~/myenv $ source env/bin/activate(env) pi@pibk:~/myenv $ python pub.py(env) pi@pibk:~/myenv $

Statistics: Posted by neilgl — Thu Aug 28, 2025 1:19 pm



Viewing all articles
Browse latest Browse all 1579

Trending Articles