I have a Python app that I use locally that needs to be launched via pipenv run python3 appname.py
in order to load virtual environment with installed dependencies. This is all on macOS.
What I want to achieve is to be able to run this app from anywhere with $ appname [args]
.
So what I did was:
- add
#!/usr/bin/env pipenv run python3
toappname.py
; - make that file executable with
chmod +x appname.py
; - make symlink with
ln -s /path/to/appname.py ~/.bin/appname
; - put
~/.bin
on my$PATH
.
Now when I launch $ appname
, pipenv
creates a new virtual environment in the ~/.bin
folder and complains about missing dependencies, all instead of following through into the actual location of the script.
Is there a way to overcome this? Or maybe a better way to achieve what I want?