Skip to content

Instantly share code, notes, and snippets.

@izmailoff
Last active May 16, 2022 08:14
Show Gist options
  • Save izmailoff/9e499b663857da865396e05bda92a286 to your computer and use it in GitHub Desktop.
Save izmailoff/9e499b663857da865396e05bda92a286 to your computer and use it in GitHub Desktop.
Setup virtual python environment
# OSX specific install commands:
brew install pyenv
pyenv install 3.6.8
# or if fails:
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 3.6.8
# the rest of the commands work both on OSX and Linux:
virtualenv -p /Users/alex/.pyenv/versions/3.6.8/bin/python venv
source venv/bin/activate
python setup.py develop # if you use setup.py file, otherwise pip install -r requirements.txt
python setup.py test
# ...
deactivate
@izmailoff
Copy link
Author

izmailoff commented Nov 27, 2019

On Fedora:

Article

sudo dnf install python36
python3.6 -m venv env
. env/bin/activate
python -m pip install requests
# ...
deactivate

@izmailoff
Copy link
Author

On Ubuntu:


sudo apt install python3.8
sudo apt install python3.8-distutils
sudo apt install python3.8-venv python3.8-dev
python3.8 -m venv env

@izmailoff
Copy link
Author

In case Jupyter notebooks don't recognize/find your environment: https://janakiev.com/blog/jupyter-virtual-envs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment