I've always taught myself how to write programs, with very little formal education, so I always feel like I'm missing some things that formal education may offer. In this case, I want to install a new module for Python. It's the pyhk hotkey module. I'm helping a coworker work with hot keys. The problem I have with modules is, they completely baffle me on how to install on my computer for use.
Rarely do i get an executable, which is easy, but sometimes I think you have to copy and paste .dll's or run command prompt and import .dll's but I never really know how to do this and I just find it's strange that there is very little documentation out there to help with with this....therefore I believe i may be missing something. Can anyone help me out and explain how to install python modules?
Thanks, Mike
Let setup tools worry about directories and python path for you. Avoid copying things by hand, doing things the proper way in python for this is actually simpler than improvising and copying things by hand.
First, what about improving this useful module by using setuptools? The author helped you with useful code, now you can also contribute back by helping him with packaging!
Create a better directory structure, put the single source file inside a module to minimize the chance of namespace conflicts and create the setup.py
All you're going to need can be found here: http://pythonhosted.org/an_example_pypi_project/setuptools.html
An here follows an example:
import os
from setuptools import setup
setup(
name = "pyhk",
version = "0.0.4",
author = "Someone",
author_email = "[email protected]",
description = ("Some desc"),
license = "Some license",
packages=['pyhk'],
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
],
)
Update
First install pywin32 and pyHook...
pyhk.py
to your python Lib
directory.In Windows, the Lib
directory will be
<PATH TO PYTHON>\Lib
Example:
c:\python\Lib
In Linux, it will normally be at
/usr/lib/python2.7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With