Trinh @ Bath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
it_python [2024/03/23 23:33]
trinh
it_python [2024/11/28 10:32] (current)
trinh
Line 1: Line 1:
 ====== Notes in getting start with Python ====== ====== Notes in getting start with Python ======
  
-  * Set up Miniconda in order to have virtual python environmentshttps://medium.com/@aminasaeed223/a-comprehensive-tutorial-on-miniconda-creating-virtual-environments-and-setting-up-with-vs-code-f98d22fac8e2+Python can be complicated to set up, particularly if using virtual environments.  
 + 
 +===== Virtual environments and choosing a distribution ===== 
 + 
 +I used to setup Python via Miniconda in order to have virtual python environments (see [[https://medium.com/@aminasaeed223/a-comprehensive-tutorial-on-miniconda-creating-virtual-environments-and-setting-up-with-vs-code-f98d22fac8e2|this guide here]]. However, I don't like this approach because miniconda seems to be too aggressive in always preferring its own install. For example, the PDE Solver software Firedrake does not like Miniconda/Anaconda.  
 + 
 +Instead, so far I really like the use of [[https://github.com/pyenv/pyenv|pyenv]].  
 + 
 +Setup seems quite simple. On Mac, use homebrew to install via 
 + 
 +<code> 
 +brew install pyenv 
 +</code>  
 + 
 +You then need to include some scripts in your startup shell.  
 + 
 +Then install a distribution via 
 + 
 +<code> 
 +pyenv install 3.12  
 +</code>  
 + 
 +will install the latest version of Python 3.12. Then you can select this distribution to use as your global one:  
 + 
 +<code> 
 +pyenv global 3.12 
 +</code>