Although I am a big fan of MATLAB, it’s time for me to really try out Python so I can fairly compare the pros and cons of both languages.

The first tiny hurdle for Python is its scattered installation process for Windows. I thought Python(x,y) will give me everything in one place, but turns out the Spyder is stuck in Python 2.7. To install Python 3.7, I’ll need to do it from scratch. Here are the steps:

- Download official Python 3. You will need that for the “pip” package manager located in
`{python37}/scripts`

- Update PIP first to avoid complaints. You can run it anywhere in command prompt

`python -m pip install --upgrade pip`

You don’t call PIP to update PIP because you an executable cannot write itself in WindowsNote that for 32-bit Python, you might run into`Python37\python.exe: No module named pip`

, so you might want to use ensurepip to bootstrap:python -m ensurepip

- Now I’ll need Spyder3, a MATLAB-like IDE. Qt5 is one of the pre-req:

`pip install PyQt5`

- And finally Spyder3

`pip install Spyder`

pip does not install icons in your start menu. So I’ll need to manually create a shortcut

`{Python37}/Scripts/spyder3.exe`

.py files are not associated with Spyder3 (normally it’ll just directly run the python script with python3). I usually manually change the association in Windows to Sypder3. - PyVISA is the analog of “Instrument Control Toolbox” in MATLAB.

`pip install pyvisa`

MATLAB’s Instrument Control Toobox also cover serial ports, which is done in Python by PySerial

`pip install PySerial`

- Numpy is included with scipy:

`pip install scipy`

- Turns out that only NumPy and IPython is installed with SciPy, not the entire ecosystem.

`pip install pandas`

`pip install matplotlib`

If you know the power of dataset/table objects in MATLAB like I do, you’ll jump for dataframes in panadas. - SymPy, the analog of MATLAB’s symoblic math toolbox, needs to be installed separately

`pip install sympy`

- IPython gives the ‘notebook’ feel in Mathematica, MathCAD and Maple, where the returned results are directly pasted in the same area where your command/syntax is. I rarely cared for it because I usually want the max visual real estate for my plots.

Update: I tried Anaconda (2019.03, Python 3.7.3 x64) which supposedly have everything in one place, but the Spyder it included crashes right out of the box. Jyupter is confusing as it relies on the web-browser to render the results. Feels patchy and doesn’t look like it adds more than the steps above. Uninstalled it without hesitation.

Update: To update the packages, tack `-U`

switch at the end of each of the above `pip install`

commands. Remember to follow the order of dependencies (e.g. update PyQt5 before Spyder)

731 total views