2023/02/02

Anaconda 建立不同版本python環境

 最近在學Python,是直接去下載Anaconda來安裝,裝好後就有Python可以使用。

平常在寫程式是,是利用裡面已經有的SPYDER或是Jupyter notebook,在裡面編寫程式跟執行。

但最近要下載一個套件,在目前使用的Python版本裡不支援,需要用比較舊的Python才行。

這時Anaconda就有個很好用的功能,就是它可以產生不同的虛擬環境。

Anaconda剛裝好的時後,就會有預設的一個環境,搭配當下一起安裝好的Python。

如果想要用改的版本的Python,可直接建立另一個虛擬環境,選擇不同版本的Python就行了。

這時SPYDER或是Jupyter notebook還是會用預設的Python版本在執行,所以就要做一下調整。

詳細方法可以參考這篇,寫的很仔細。

https://www.modb.pro/db/194246 

Recently, I've been learning Python by downloading and installing Anaconda. Once installed, Anaconda provides a Python distribution that I can use.

When writing code, I typically utilize the built-in IDEs like Spyder or Jupyter Notebook that come with Anaconda. I write and execute my code within these environments.

However, I recently needed to download a package that is not supported by the current version of Python I'm using. I needed an older version of Python for compatibility.

This is where Anaconda's useful feature comes in: it allows the creation of different virtual environments.

By default, Anaconda creates an environment with the Python version that was installed at that time.

If I want to use a different version of Python, I can simply create another virtual environment and choose the desired Python version.

In this case, Spyder or Jupyter Notebook will still use the default Python version for execution, so some adjustments need to be made.

沒有留言:

張貼留言