I'm new to Python development and attempting to use pipenv. I ran the command pip install pipenv
, which ran successfully:
...
Successfully built pipenv pathlib shutilwhich pythonz-bd virtualenv-clone
Installing collected packages: virtualenv, pathlib, shutilwhich, backports.shutil-get-terminal-size, pythonz-bd, virtualenv-clone, pew, first, six, click, pip-tools, certifi, chardet, idna, urllib3, requests, pipenv
...
However, when I run the command pipenv install
in a fresh root project directory I receive the following message: -bash: pipenv: command not found
. I suspect that I might need to modify my .bashrc, but I'm unclear about what to add to the file or if modification is even necessary.
Where Python store packages
Before jumping into the command that will install
pipenv
, it is worth understanding wherepip
installs Python packages.Global site-packages is where Python installs packages that will be available to all users and all Python applications on the system. You can check the global site package with the command
For example, on Linux with Python 3.7 the path is usually
User site-packages is where Python installs packages available only for you. But the packages will still be visible to all Python projects that you create. You can get the path with
On Linux with Python 3.7 the path is usually
Using Python 3.x
On most Linux and other Unices, usually Python 2 and Python 3 is installed side-by-side. The default Python 3 executable is almost always
python3
.pip
may be available as either of the following, depending on your Linux distributionLinux
Avoid using
pip
withsudo
! Yes, it's the most convenient way to install Python packages and the executable is available at/usr/local/bin/pipenv
, but it also mean that specific package is always visible for all users, and all Python projects that you create. Instead, use per-user site packages instead with--user
pipenv
is available atmacOS
On macOS, Homebrew is the recommended way to install Python. You can easily upgrade Python, install multiple versions of Python and switch between versions using Homebrew.
If you are using Homebrew'ed Python,
pip install --user
is disabled. The global site-package is located atand you can safely install Python packages here. Python 3.y also searches for modules in:
Windows
For legacy reasons, Python is installed in
C:\Python37
. The Python executable is usually namedpy.exe
, and you can runpip
withpy -m pip
.Global site packages is installed in
Since you don't usually share your Windows devices, it is also OK to install a package globally
pipenv
is now available atI don't recommend install Python packages in Windows with
--user
, because the default user site-package directory is in your Windows roaming profileThe roaming profile is used in Terminal Services (Remote Desktop, Citrix, etc) and when you log on / off in a corporate environment. Slow login, logoff and reboot in Windows can be caused by a large roaming profile.
This fixed it for me: