I have a core set of bash aliases defined in my .bash_profile
(Mac). But when I activate a pipenv with pipenv shell
, my aliases don't work and the bash alias
command returns nothing.
Is there a configuration step needed to spawn pipenv shells that inherit bash aliases from the parent shell?
Bash Alias allows to aggregate multiple functions into a single command and also it avoids repetitive or large commands into a simple shortcut command. BASH Alias is a map of shortcut command with the sets of commands which are stored in a file called either . bash_profile or . bashrc with a specific syntax.
You need to put bash shell aliases in the ~/. bashrc file ($HOME/. bashrc) file executed by bash for non-login shells. On most modern Linux distros, you may want to put all your bash alias definitions into a separate file like ~/.
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip , virtualenv , and the good old requirements. txt . In addition to addressing some common issues, it consolidates and simplifies the development process to a single command line tool.
To activate the environment, just navigate to your project directory and use pipenv shell to launch a new shell session or use pipenv run <command> to run a command directly.
Aliases are never inherited. .bash_profile
is only sourced for login shells, and pipenv
apparently creates a nonlogin interactive shell. Aliases should be defined in .bashrc
, and on a Mac (where terminal emulators starts login shells by default), add [[ -f ~/.bashrc ]] && source ~/.bashrc
to the end of your .bash_profile
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With