I installed a library through pip that only worked with Python2. I modified the source a bit to make it work with Python3, however I would like to repackage my modified version so that I can move it to another PC. How can I do it?
Asked
Active
Viewed 1,074 times
2 Answers
2
See any of these references from the docs/stackoverflow:
- An Overview of Packaging for Python
- Packaging Python Products (Tutorial)
- Packaging and Distributing Projects (Guide)
- this minimal example from bgse at StackOverflow
The process essentially consists of:
- creating the package through directory structure and
__init__.py
- using
setuptools
to specify project metadata - installing with
pip
- optionally uploading to PyPI with
twine
.

Dustin Ingram
- 20,502
- 7
- 59
- 82

pkfm
- 451
- 3
- 7
1
Your package should have a setup.py that come with it
python3 setup.py bdist_wheel
This will create directory called dist
containing a python wheel file
ls -l dist\*.whl
Copy that file to the other system and
pip3 install <file_name>.whl

William D. Irons
- 2,244
- 1
- 18
- 19
-
This assumes that the two platforms are the same, which might not be the case, and the install might fail. A source distribution (`python setup.py sdist`) would be guaranteed to work. – Dustin Ingram Jun 28 '19 at 17:19