1

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?

phd
  • 82,685
  • 13
  • 120
  • 165
Luca Giorgi
  • 910
  • 3
  • 14
  • 28

2 Answers2

2

See any of these references from the docs/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