rainbowsorbet
rainbowsorbet

Reputation: 563

How to install and access python module locally?

Trying to follow what I understand to be best practices, I installed pipenv to be able to install a python module locally (and not break any other programs or dependencies). Of course, I installed pipenv locally, using

$ pip install --user pipenv

Unfortunately, a subsequent call to pipenv yields the following:

$ pipenv install requests
-bash: pipenv: command not found

So pipenv isn't available in the shell, despite being freshly installed. I believe (from googling) that the problem has to do with my PATH and perhaps I need to add my user directory to my .bashrc file? But I'm not sure what exactly to add to the .bashrc file to fix the problem.

Upvotes: 1

Views: 680

Answers (1)

Clayton L
Clayton L

Reputation: 568

pip --user installs to ~/.local/bin.

Therefore, you can add the following line to your ~/.bashrc:

export PATH=$PATH:$HOME/.local/bin

Then run source ~/.bashrc or open a new terminal session and pipenv should be found.

Upvotes: 5

Related Questions