Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install a .whl file in a PyCharm virtualenv?

Tags:

The package manager in Project Interpreter doesn't appear to have any way for me to run a pure pip command so I'm unable to install the wheel as I normally would through command line.

Running through command line installs the wheel on my base python install and not the virtualenv. Help?

like image 444
Awebb Avatar asked Sep 30 '16 12:09

Awebb


People also ask

How do I manually install a package in PyCharm?

Expand the list of the available versions in the upper-right corner of the tool window. Select the required version or keep it the latest. Click the Install button next to the version list. Once PyCharm notifies you about successful installation, you should see the package in the list of the installed packages.

How do I unzip a .WHL file?

whl file can be extracted using unzip or by right clicking on the file and extracting using the Extract Here graphical interface in Ubuntu/Debian systems. After extracting, one can inspect the source code of . py files and the contents of metadata files which will be located in library-name-with-version.


2 Answers

You can install it from PyCharm's Python console with the pip module :

import pip  def install_whl(path):     pip.main(['install', path])  install_whl("path/to/file.whl") 
like image 55
Clément F Avatar answered Sep 18 '22 16:09

Clément F


To install via your command line, and avoid installing on your base Python, you'll have to first activate the virtualenv.

You can do this on POSIX using:

$ source path_to_your_venv/bin/activate 

And then for Windows systems:

> path_to_venv\Scripts\activate 

You can then install the .whl file with pip install filename.whl while the virtual env has been activated.

like image 30
Moses Koledoye Avatar answered Sep 21 '22 16:09

Moses Koledoye