Python is a popular programming language that gives users access to numerous modules. However, for the usage of those modules, the user needs to install those modules. The most common way of installing the Python modules is using the root access. While the most common way is using the root access, there are various other ways to install such modules too in case the user doesn’t have root access or the root access way doesn’t work. In this article, we will study what is root access, and what are the numerous other ways to install Python modules without root access.
What is Root Access?
The process of running the Python commands as an admin is called root access. Most of the commands with root access start with the keyword ‘sudo‘.
Syntax: sudo command -v python
Installing Python modules without Root Access
- Using pip command
- Using Anaconda
- Using Anaconda environment
- Using virtualenv environment
- Using pipenv environment
Using PIP Command
The management system used to install or upgrade the libraries in Python is called the pip command. In this way, we will see how we can install the Python module using the pip command.
Syntax: pip install –user package_name
Installing Pillow in Terminal
To install the Python module, Pillow using pip command, we can write the following command:
pip install --user Pillow
Output
Note: You can refer the article (link) to know how to install pip in the Python.
Using Anaconda
The software that creates an environment for the Python, which allows the user to install Python modules is called anaconda. In this way, we will see how we can install python module in anaconda.
Syntax: conda install package_name
Installing Pillow using Anaconda
To install the python module, Pillow in anaconda, we can write the following command:
conda install Pillow
Output:
Note: You can refer the article (link) to know how to install anaconda in the Python.
Using Anaconda Environment
There are various types of environments which support the installing of Python modules, one such environment is anaconda environment. In this way, we will see how we can create anaconda environment and install Python modules.
Syntax to create local env in anaconda
conda create -n myenv python=3.9
Syntax to install package in using Anaconda env.
Syntax: conda install -n env-name package-name
Installing Pillow
To install the python module, Pillow in anaconda, we can write the following command:
conda install -n env-name package-name
Output:
Using Virtualenv Environment
The other environment which helps in installing and upgrading Python modules is known as virtual environment. In this way, we will see how we can create virtualenv environment and install Python modules.
Syntax: pip install package-name
Installing Pillow
To install the python module, Pillow in virtualenv environment, we can write the following command:
pip install Pillow
Output:
Creating pipenv Environment
The pipenv is the one of the crucial environments which help in installing or upgrading the Python modules. In this way, we will see how we can create pipenv environment and install Python modules.
You can create the pipenv environment using the following command:
pip install --user pipenv
Syntax to install package in using pipenv env.
Syntax: python -m pipenv install package_name
Installing Pillow
To install the python module, Pillow in pipenv environment, we can write the following command:
python -m pipenv install Pillow
Output: