Configuration
- Use pip3 to install packages for python3.7 while use pip for python3.6.
- Install a certain package to the designated postion:
1
pip install -t /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (package name)
- See the path concerning one certain version of python:>
import sys print(sys.path) - Get the list of modules in one version of python:>
help(modules)
Programming Errors
- >
arrayOfLines = fr.readlines(fr) - >
mat = empty(3, 2) - When showing syntaxError, check the parenthesis.
Python Notes
reloadis no longer used in python3, to do this, we need to import importlib first.>import importlib importlib.reload(module)os.path.dirname(__file__)works in .py file but not in ipython or Jupyter notebook. In Jupyter notebook, directly use the relative path.