AttributeError? Installing pipenv on Ubuntu.

Installing a Python environment on Ubuntu is a dangerous road. You can easily crush your OS since Ubuntu is made using Python. I personally had to install a new OS after mine crushed after installing pipenv on the default python 2.7 that came with Ubuntu 20.

To successfully install pipenv and run pipenv shell on your laptop, follow EXACTLY this procedure.

You'll need to install python3 on your machine since the pipenv will run on python3 instead of the default python, otherwise, you are likely to crush your OS just like I did. You can check if you already have Python3 installed by checking the version using the command:

python3 --version

If you don't have python3 installed yet, you can install it using the commands:
Run sudo apt update to get the latest version of Python3 and update your package list.

Install Python3 by running sudo apt install python3

To verify your installation, you can run python3 --version to see the version of python3 installed.

You can now install pip3 to install additional packages for python 3. (Beware not to install them using pip since it could lead to attribute errors on your machine). To install pip3, use this command:

sudo apt install python3-pip

You can now install packages using pip3 install packageName.

With python3 installed, you can now run pipenv --python (put the version of your python3 here) install. For instance, pipenv --python 3.10.12 install for my version.

You will see something like this:

You can then use pipenv shell to get into the virtual environment and run your code.

HAPPY CODING.

0
Subscribe to my newsletter

Read articles from Austine Jack Were directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Austine Jack Were
Austine Jack Were

I am Austine Jack Were from Kenya, and I am a full-stack developer! I have a strong background in data structures, Python, C, JavaScript, ReactJS, NodeJS, and Django. I have experience building web applications using JavaScript, HTML, and CSS and creating engaging web interfaces using ReactJS and Tailwind CSS. I also develop efficient backend systems using NodeJS or Python with Django. If you're looking for a skilled developer to bring your ideas to life, please don't hesitate to reach out.