[Tutor] Running an app from a virtual environment
Phil
phillor9 at gmail.com
Sat May 13 00:12:20 EDT 2023
This how I currently have my virtual environments set up:
myproject/
|myapp.py
|.venv
| |bin
| |include
| |lib
Originally I had myapp.py stored under /bin where I could run it like this:
./python3 myapp.py.
However, I discovered recently that I should have myapp.py stored under
the root directory as shown above. VS code still finds the app and I can
continue working on it and running it from VS code but I can no longer
run the same app from the virtual environment because a module that is
stored in the .venv/lib cannot be found by myapp.py.
My AI friend has not been very helpful with this problem and an Internet
search has offered a couple of suggestions that involve adding an extra
line or two to myapp.py. Shouldn't myapp.py be able to be run from a
virtual environment without modification and how do I run my creations
after development has been completed?
I solved this problem by using pipx to install the missing module which
results in it being stored at ~/.local/bin. I'm not sure if this is the
correct procedure. I'm still inclined to think that myapp.py should be
able to be run from the virtual environment and find the module in the
lib directory.
--
Regards,
Phil
More information about the Tutor
mailing list