-
-
Save esprengle/f64395b5eb1a798ed18e1a3710a7ed84 to your computer and use it in GitHub Desktop.
A script for installing IPython on Pyto (11.1.12+)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Installs IPython on Pyto. | |
Usage: Usage: import requests as r; exec(r.get('https://bit.ly/35iSbM1').content.decode()) | |
""" | |
from pip import main as pip | |
import os.path | |
docs = os.path.expanduser("~/Documents") | |
site_packages = os.path.join(docs, "site-packages") | |
_bin = os.path.join(docs, "stash_extensions/bin") | |
# Install IPython | |
try: | |
pip(["install", "ipython"]) | |
except: | |
pass | |
# Install ptyprocess | |
try: | |
pip(["install", "ptyprocess"]) | |
except: | |
pass | |
if not os.path.exists(_bin): | |
os.makedirs(_bin) | |
# Disable SyntaxWarning | |
runner = """'''???''' | |
import warnings | |
import code | |
import console | |
def start(banner=None, readfunc=None, local=None, exitmsg=None): | |
with warnings.catch_warnings(record=True) as w: | |
from IPython import start_ipython | |
start_ipython() | |
code.interact = start | |
console.interact = start | |
if __name__ == "__main__": | |
start() | |
""" | |
with open(os.path.join(_bin, "ipython.py"), 'w') as f: | |
f.write(runner) | |
with open(os.path.join(_bin, "ipython3.py"), 'w') as f: | |
f.write(runner) | |
print("") | |
print("Restart Pyto to launch IPython shell. IPython can be executed from the script in ~/Documents/stash_extensions/bin/ipython.py, from the 'Run module' section or just by importing it.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment