Videos
I'd like to install a module named "win32gui" and i have no clue how to do it... Couldn't find any YouTube tutorials either.
ยป pip install download
The officially recommended way to install packages from a script is by calling pip's command-line interface via a subprocess. Most other answers presented here are not supported by pip. Furthermore since pip 10.x, all code has been moved to pip._internal precisely in order to make it clear to users that programmatic use of pip is not supported.
Use sys.executable to ensure that you will call the same pip associated with the current runtime.
For example:
import subprocess
import sys
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
[DEPRECATED since pip v10, March 2018 (see accepted answer instead)]
You can also use something like:
import pip
def install(package):
if hasattr(pip, 'main'):
pip.main(['install', package])
else:
pip._internal.main(['install', package])
# Example
if __name__ == '__main__':
install('argh')
Open terminal if on MacOS or Command Prompt if on Windows
Run command (replace package_name with the name of the module you want to install:
pip install package_name
This method holds true for most of the python libraries that are available. The command installs the latest version of the module that you specify along with its dependencies from the Python Package Index
The Python Package Index (PyPI) is a repository of software for the Python programming language.
From: pypi.org
First, you have to install pip which is a package manager for Python packages/modules.
1-1. How to install pip on Windows
1-2. How to install pip on MacOS
2. Open Command Prompt(Windows)/terminal(MacOS)
Run command:
pip install openpyxlIf you need to install any other extra modules repeat 3
pip install 'module_name'
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install
setuptools:curl https://bootstrap.pypa.io/ez_setup.py | pythonInstall
pip:curl https://bootstrap.pypa.io/get-pip.py | pythonOptionally, you can add the path to your environment so that you can use
pipanywhere. It's somewhere likeC:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use pip to install packages from the Python Package Index.
cd C:\Python\Scripts\
pip.exe install <package-name>
In your case run:
pip.exe install mechanize