-
Notifications
You must be signed in to change notification settings - Fork 0
Python Virtual Environments
To check if your Pipenv virtual environment is running, try the following methods:
Run:
echo $VIRTUAL_ENV- If it prints a path (e.g., /home/user/.local/share/virtualenvs/myproject-xxxx), Pipenv is running.
- If it's empty, Pipenv is not active.
Alternatively, you can try:
pipenv --venv- If the command returns a path, the environment exists.
- If you see No virtualenv has been created, run pipenv shell to start it.
Run:
which pythonor on Windows:
where python- If it points to a path inside .venv or virtualenvs/, Pipenv is running.
- If it points to the system Python (/usr/bin/python or C:\Python), Pipenv is not active.
If you are in the wrong virtual environment you may exit the current virtual environment.
Run:
exitor
deactivateNavigate to the correct project directory
If you're not already there, run a command to navigate to the correct directory:
cd ~/OneDrive/Coding\ Projects/docker-django-demoActivate the correct virtual environment
If you’re using pipenv, run:
pipenv shellTo check the dependencies installed in the virtual environment.
Check installed packages (if using Pipenv)
Run:
pip listIf it shows only system packages and not the ones from your Pipfile.lock, Pipenv might not be running.
If Pipenv is not running, start it with:
pipenv shellor run a command inside Pipenv:
pipenv run pythonInstall dependencies (if needed)
If you get a ModuleNotFoundError: No module named 'dotenv', install missing packages:
if using pipenv:
pipenv installRun
python manage.py runserverThese command should resolve any issues! 🚀