Skip to content

Instantly share code, notes, and snippets.

@halfk1ng
halfk1ng / python_environment_setup.md
Created February 15, 2021 22:07 — forked from Geoyi/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant
@halfk1ng
halfk1ng / pythondoneright.md
Created February 15, 2021 20:41 — forked from MuhsinFatih/fix-macos-python.md
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
@halfk1ng
halfk1ng / bot.py
Created June 10, 2020 03:16 — forked from ty-porter/bot.py
Voting bot that removes posts if threshold is not met
import praw
from datetime import datetime
class Bot:
REDDIT = praw.Reddit(username='REDDIT_USERNAME',
password='REDDIT_PASSWORD',
client_id='REDDIT_CLIENT_ID',
client_secret='REDDIT_CLIENT_SECRET',