How to activate the virtual environment for python?
Your virtual environment was created with virtualenvwrapper. Activate it with command workon mysite-virtualenv
in bash console on PythonAnywhere.
For the web app you need to set it on the "Web" configuration page.
How do I activate a virtualenv inside PyCharm's terminal?
Edit:
According to https://www.jetbrains.com/pycharm/whatsnew/#v2016-3-venv-in-terminal, PyCharm 2016.3 (released Nov 2016) has virutalenv support for terminals out of the box
Auto virtualenv is supported for bash, zsh, fish, and Windows cmd. You
can customize your shell preference in Settings (Preferences) | Tools
| Terminal | check Activate virtaulenv
you also need to make sure to have the path of virtual environment path included in the content root folder of your project structure. You can go to settings (preference) | project | Project Structure | if your environment is not included in the project directory.
***Old Method:***
Create a file .pycharmrc
in your home folder with the following contents
source ~/.bashrc
source ~/pycharmvenv/bin/activate
Use your virtualenv path as the last parameter.
Then set the shell Preferences->Project Settings->Shell path to
/bin/bash --rcfile ~/.pycharmrc
How to leave/exit/deactivate a Python virtualenv
Usually, activating a virtualenv gives you a shell function named:
$ deactivate
which puts things back to normal.
I have just looked specifically again at the code for virtualenvwrapper
, and, yes, it too supports deactivate
as the way to escape from all virtualenvs.
If you are trying to leave an Anaconda environment, the command depends upon your version of conda
. Recent versions (like 4.6) install a conda
function directly in your shell, in which case you run:
conda deactivate
Older conda versions instead implement deactivation using a stand-alone script:
source deactivate
How to activate python env via linux script?
Update
thanks to @Charles Duffy @alaniwi
source /home/username/.local/env_myapp/bin/activate
echo "check - activate env"
now the Script starts my env in the terminal.
(did know how to close the Question, via Question comments. so i wrote the answers of @Charles Duffy @alaniwi here)
Related Topics
How to Select a HTML Element No Matter What Frame It Is in in Selenium
Why Is Printing to Stdout So Slow? Can It Be Sped Up
Cross-Platform Subprocess With Hidden Window
Strange Result When Removing Item from a List While Iterating Over It
What Is Truthy and Falsy? How Is It Different from True and False
How to Use Threading in Python
How to Unload (Reload) a Python Module
How to Find All Occurrences of an Element in a List
How to Download a File Over Http
Post Values from an HTML Form and Access Them in a Flask View
Run Multiple Python Scripts Concurrently
Python Multiprocessing: Permission Denied
Regexp Finding Longest Common Prefix of Two Strings
Why Does My Recursive Function Return None