I'm on MacOSX (12.0.1) and with Python 3.9. I want to create a simple python package for personal use. Upon creating the package using python setup.py install
, almost everything works: I can import the package when using python, etc. However, I've tried to follow every tutorial online to create an associated executable script. I.e., a command that I can execute from the shell that contains some functionality from the package I made. However, nothing has worked.
My setup.py code:
from setuptools import setup
setup(name='my_package',
version='1.0.0',
description='heeheehoohoo',
author='Me',
author_email='me@me',
url='me.com',
packages=['my_package'],
entry_points={
'console_scripts': ['mypkg=my_package:run']},
install_requires=['cairosvg',
'selenium',
'PyPDF2',
],
include_package_data=True,
zip_safe=False
)
And under my_package/__init__.py
I have:
from . mine import main
def run():
import argparse
parser = argparse.ArgumentParser(prog = 'eeeeeee', description = 'eeeeee')
parser.add_argument('eeeeee', help = 'eeeeeee')
args = parser.parse_args()
print(f'eeeee ...')
main(args.eeeeeee)
print(f'Success!')
Everything gets installed, yet for some reason when I try to execute $ mypkg
, I get zsh: command not found: mypkg
. From python, I can import the function and directly try to execute run()
. And strangest of all, each tutorial I have seen that has done anything like this can execute the commands without a problem once they'd executed python setup.py install
.
Thank you!
Setting pip to the respective version of python and using pip install .
instead of python setup.py install
did the trick. However, it's still strange that python setup.py install
does not work...