Python
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
python
Ctrl+D
quit()
python -c command
python -m module
python -i script
Ctrl+C # interrupt
#a python script name myscript.py
***************************************
#! /usr/bin/env python
xyz = 1
if xyz:
print "python script is executed"
***************************************
chmod +x myscript.py
./myscript.py
or python myscript.py
execute script from interactive python shell (Python 3)
>>> exec(open('myscript.py').read())
#clear up screen
import os
os.system('clear')
ipython3 nbconvert --to=python *.ipynb
Install python3 and pip3 as local user on shared Linux
http://thelazylog.com/install-python-as-local-user-on-linux/
mkdir ~/python
cd ~/python
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar zxfv Python-3.6.4.tgz
#not used #find ~/python -type d | xargs chmod 0755
cd Python-3.6.4
./configure --prefix=$HOME/python
make && make install
#Edit ~/.bashrc_profile and add the following lines:
export PATH=$HOME/python/Python-3.6.4/:$PATH
export PYTHONPATH=$HOME/python/Python-3.6.4
source ~/.bashrc_profile
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py -O - | python3 - --user
#Edit ~/.bashrc_profile and add the following lines:
export PATH=$HOME/.local/bin:$PATH