- Install Python 3 and Pip (Install Pip)
- Check that python 3 is installed:
which python3 - Install
virtualenv(https://sourabhbajaj.com/mac-setup/Python/virtualenv.html)
cdinto your project directory- Make a file
requirements.txtlisting every external module you need. One on each line. - Make your virtualenv:
virtualenv venv --python=$(which python3) - Activate the environment:
source venv/bin/activate - Install the requirements:
pip install -r requirements.txt - Run your python script
python ... - Deactivate the environment when you're done:
deactivate(You can always reactivate with step 4)
- File --> Settings --> Search "Project Interpreter"
- Click the settings cog on upper right --> Click add
- Make sure you're in "virtualenv envrionment" submenu (see left pane)
- Select New Envrionment --> Select base interpreter to be some Python3 interpreter
- Make your
requirements.txtfile as above. - Click "install requirements" while you're in that file and you're editing (PyCharm will warn you of uninstalled deps)