Wednesday, 21 November 2018

pip - How do I install a Python package with a .whl file?



I'm having trouble installing a Python package (specifically, JPype1 0.5.7) on my Windows machine, and would like to install it with Christoph Gohlke's Window binaries. (Which, to my experience, alleviated much of the fuss for many other package installations.)



However, while Christoph used to provide .exe files in the past, recently it seems he's uploading .whl files instead.




http://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype



But how do I install .whl files?




Notes:




  • I've found documents on wheel, but they don't seem so staightforward in explaining how to install .whl files.


  • This question is a duplicate with this question, which wasn't directly answered.



Answer



I just used the following which was quite simple. First open a console then cd to where you've downloaded your file like some-package.whl and use



pip install some-package.whl


Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. If pip is not installed, this page can help:

How do I install pip on Windows?



Note: for clarification
If you copy the *.whl file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters --



pip install C:/some-dir/some-file.whl

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...