Reputation: 2009
I have followed the pip tutorial at http://peterdowns.com/posts/first-time-with-pypi.html. But when i run pip install mypackage
it installs the source code into site-packages
under my Python folder.
How can i make it install into path, so i can run $ mypackage
?
That is, I would like to be able to use my python package as a regular binary application. Right now i can cd
into the folder under site-packages
and run chmod +x mypackage.py
, then ./mypackage.py
to run it. But i would like to be able to run it from any directory.
Upvotes: 0
Views: 163
Reputation: 10082
Ideally you do it by defining console scripts
in your package configuration. Then you install the package with pip just as you have done before (or better in a virtualenv
), but during the installation a link will be created in the bin
directory to the console script that you have configured. See e.g. http://calvinx.com/2012/09/09/python-packaging-define-an-entry-point-for-console-commands/
Upvotes: 1