Where python stores packages
Before moving on to the command that installs pipenv , you should understand where pip installs Python packages .
Global site packages are 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
python -m site
For example, on Linux with Python 3.7, the path is usually
/usr/lib/python3.7/dist-packages/setuptools
Custom site packages are where Python installs packages available only to you. But packages will still be visible to all the Python projects you create. You can get the path with
python -m site --user-base
On Linux with Python 3.7, the path is usually
~/.local/lib/python3.7/site-packages
Using Python 3.x
On most Linux and other Unix, usually Python 2 and Python 3 are installed in parallel. The default Python 3 executable is almost always python3 . pip may be available in the following cases, depending on your Linux distribution
pip3 python3-pip python36-pip python3.6-pip
Linux
Avoid using pip with sudo ! Yes, this is the most convenient way to install Python packages, and the executable is available at /usr/local/bin/pipenv , but it also means that a specific package is always visible to all users and all the Python projects you create. Instead, use site packages for each user instead of --user
pip3 install --user pipenv
pipenv is available on
~/.local/bin/pipenv
Macos
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 disabled. The global package site is located at
/usr/local/lib/python3.y/site-packages
and you can safely install Python packages here. Python 3.y is also looking for modules in:
/Library/Python/3.y/site-packages ~/Library/Python/3.y/lib/python/site-packages
Window
For obsolete reasons, Python is installed in C:\Python37 . The Python executable is usually called py.exe , and you can run pip with py -m pip .
Global site packages installed in
C:\Python37\lib\site-packages
Since you usually donβt share your Windows devices, you can also install the global package
py -m pip install pipenv
pipenv now available on
C:\Python37\Scripts\pipenv.exe
I do not recommend installing Python packages on Windows with --user , because the directory of custom site packages is by default in your Windows roaming profile
C:\Users\user\AppData\Roaming\Python\Python37\site-packages
The roaming profile is used in Terminal Services (Remote Desktop, Citrix, etc.) and when logging in / out in a corporate environment. Slow login, logout, and reboot on Windows can be caused by a large roaming profile.