Modules for Python are akin to extensions for browsers; it just makes you a more powerful programmer. However, there are some times when you might face some difficulty in installing python modules. The two most common reasons are:
The two most common reasons for the failure of python installation module through python pip are:
- If you have more than one Python programs. For instance, if you use both the official Python and Enthought’s Canopy flavor of Python.
- If you don’t run programs with root privileges.
The module installation access denied error looks like this on the Windows PC. It reads “this app can’t run on your PC. To find a version for your PC, check with the software publisher.”
This technical guide has the solution to both these instances — in a step by step process.
- Add your Python Scripts directory to Windows environmental variable. (Skip this step, if you have already done this).If you don’t know your python scripts directory, go hit file–>save as on your IDLE, and the destination folder will have your scripts directory. To add an environment variable, go to windows search option, and type environment variable. Select “edit system environment variables”–> a dialogue box will open, under system variable, click on path –> add the scripts directory, be sure to include a semicolon (;) after the directory nameWhy is this step important? This is essential to let command prompt run “pip” command. if you don’t do this, it would not allow you to install using pip command.
- Now, go to command prompt, and type python -m pip install <module name>, so if you want to install a python module called “selenium”, type python – m pip install selenium.
Why should you do this? This is sudo command in Ubuntu; this gives you a superuser access. - You are all set, use this command to install just any python module using Pip.
If you still find it difficult, then watch the video below that I have made which explains the entire process. If you find any difficulty in entering an environment variable for python or installing a python module, then drop a comment and I would do my best to help you.