Install Python Package On Per User Basis

Shweta Lodha
1 min readJun 17, 2022

Many times it may happen that you want to install a Python package, but you do not have permission to do so at system level.

Then how can we create or run our Python application? How to make that package available for use?

This article focuses on solving this problem with a very simple trick.

One solution to this problem could be to install a package in our own space, rather than touching system area. In other words, restricting everything to our login rather than installing it for all the users using the machine?

Let’s see how we can achieve this solution. Usually, we install any Python package using below command:

pip install PACKAGE_NAME

On execution of this command, a package will appear in the site-packages directory under sys.path.

Apart from this, Python also has a per-user installation directory which is located at ~\AppData\Local\Programs\Python\Python310\Lib\site-packages. In order to restrict package installation to this directory, we need to change our command a little bit as shown below:

pip install — — user PACKAGE_NAME

--

--

Shweta Lodha
Shweta Lodha

No responses yet

What are your thoughts?