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

后端 未结 17 1995
刺人心
刺人心 2020-11-22 00:54

I\'m having trouble installing a Python package on my Windows machine, and would like to install it with Christoph Gohlke\'s Window binaries. (Which, to my experience, allev

相关标签:
17条回答
  • 2020-11-22 01:12

    On the MacOS, with pip installed via MacPorts into the MacPorts python2.7, I had to use @Dunes solution:

    sudo python -m pip install some-package.whl
    

    Where python was replaced by the MacPorts python in my case, which is python2.7 or python3.5 for me.

    The -m option is "Run library module as script" according to the manpage.

    (I had previously run sudo port install py27-pip py27-wheel to install pip and wheel into my python 2.7 installation first.)

    0 讨论(0)
  • 2020-11-22 01:17

    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
    
    0 讨论(0)
  • 2020-11-22 01:19

    What I did was first updating the pip by using the command: pip install --upgrade pip and then I also installed wheel by using command: pip install wheel and then it worked perfectly Fine.

    Hope it works for you I guess.

    0 讨论(0)
  • 2020-11-22 01:20

    The only way I managed to install NumPy was as follows:

    I downloaded NumPy from here https://pypi.python.org/pypi/numpy

    This Module

    https://pypi.python.org/packages/d7/3c/d8b473b517062cc700575889d79e7444c9b54c6072a22189d1831d2fbbce/numpy-1.11.2-cp35-none-win32.whl#md5=e485e06907826af5e1fc88608d0629a2
    

    Command execution from Python's installation path in PowerShell

    PS C:\Program Files (x86)\Python35-32> .\python -m pip install C:/Users/MyUsername/Documents/Programs/Python/numpy-1.11.2-cp35-none-win32.whl
    Processing c:\users\MyUsername\documents\programs\numpy-1.11.2-cp35-none-win32.whl
    Installing collected packages: numpy
    Successfully installed numpy-1.11.2
    PS C:\Program Files (x86)\Python35-32>
    

    PS.: I installed it on Windows 10.

    0 讨论(0)
  • 2020-11-22 01:22

    EDIT: THIS NO LONGER IS A PART OF PIP

    To avoid having to download such files, you can try:

    pip install --use-wheel pillow
    

    For more information, see this.

    0 讨论(0)
  • 2020-11-22 01:22

    You can install the .whl file, using pip install filename. Though to use it in this form, it should be in the same directory as your command line, otherwise specify the complete filename, along with its address like pip install C:\Some\PAth\filename.

    Also make sure the .whl file is of the same platform as you are using, do a python -V to find out which version of Python you are running and if it is win32 or 64, install the correct version according to it.

    0 讨论(0)
提交回复
热议问题