I have a Python library which includes some scripts that are installed during setup (python setup.py install
). I've installed the library in a Conda environment.
The script is installed using the script key in my setup.py:
setup(
...
scripts=['scripts/my_app'],
)
When I active my Conda environment with the package installed, I expect to be able to call it from the command line (ie its in my PATH). On Linux and Mac there's no problem with this.
On Windows, the script is added to the system path, but if I run it in Powershell (my_app
), it launches a request to open the file which contains:
#!C:\Users\Me\AppData\Local\conda\conda\envs\my_env\python.exe
# EASY-INSTALL-SCRIPT: 'my_package==0.0.1','my_app'
__requires__ = 'my_package==0.0.1'
__import__('pkg_resources').run_script('my_package==0.0.1', 'my_app')
In an Anaconda (DOS) prompt, it doesn't work at all (not recognised). The code runs fine if I call the program from the library folder (e.g. python ./scripts/my_app
).
The conda env is otherwise fine, I can import the package within an interpreter or other python script. So python is definitely in my path, and it's the correct python.
Is there some additional setup required for Windows? It seems like it's finding the wrapper around the script, but it's not executing it as a python file.
(This may be a duplicate question, but it's quite hard to search for!)