Posts

Showing posts with the label Virtualenv

Bash: Mkvirtualenv: Command Not Found

Answer : Solution 1 : For some reason, virtualenvwrapper.sh installed in /usr/bin/virtualenvwrapper.sh , instead of under /usr/local/bin . The following in my .bash_profile works... source "/usr/bin/virtualenvwrapper.sh" export WORKON_HOME="/opt/virtual_env/" My install seems to work fine without sourcing virtualenvwrapper_bashrc Solution 2 : Alternatively as mentioned below, you could leverage the chance that virtualenvwrapper.sh is already in your shell's PATH and just issue a source `which virtualenvwrapper.sh` Try: source `which virtualenvwrapper.sh` The backticks are command substitution - they take whatever the program prints out and put it in the expression. In this case "which" checks the $PATH to find virtualenvwrapper.sh and outputs the path to it. The script is then read by the shell via 'source'. If you want this to happen every time you restart your shell, it's probably better to grab the output from t...

Auto Activate Virtual Environment In Visual Studio Code

Answer : You don't need this line at all. Just remove it and switch your Python interpreter to point to the one within your venv . Here's a relevant documentation (italicized emphasis mine): To select a specific environment, use the Python: Select Interpreter command from the Command Palette ( Ctrl + Shift + P ). ... and opening a terminal with the Terminal: Create New Integrated Terminal command. In the latter case, VS Code automatically activated the selected environment. Once you switch the interpreter VS code should create a .vscode folder within your workspace with a settings.json indicating the python interpreter. This will give VS code the direction of where to locate the venv . This is how I did it in 2021: Enter Ctrl + Shift + P in your vs code. Locate your Virtual Environment: Python: select interpreter > Enter interpreter path > Find Once you locate your virtual env select your python version: your-virtual-env > b...