開發Python 使用 Visual Studio Code + Anaconda

由於Pycharm需要付費,因此嘗試了 Visual Studio Code加上Anaconda 來開發python程式,

可以先下載 VS  Code (https://code.visualstudio.com/)
然後下載 Anaconda (https://www.anaconda.com/distribution/)

安裝完VS Code後,安裝Python extension for VS Code,


接著安裝Anaconda,然後在環境變數中設定
D:\Anaconda3 D:\Anaconda3\Scripts D:\Anaconda3\Library\bin

如果python.exe的路徑有問題,可以在檔案 -> 首選項 -> 設定 ->python.pythonPath中去設定

建立第一個Python程式可以參考: https://code.visualstudio.com/docs/python/python-tutorial

先建立一個資料夾,再新增一個helloworld.py到資料夾中,

在helloworld.py寫上
print("hello")



後按右鍵出現下拉視窗,選擇"Run Python File in Terminal"

PS C:\Users\xxxxx\Desktop\vscode> & C:/Users/xxxxx/Anaconda3/python.exe c:/Users/xxxxx/Desktop/vscode/helloworld.pyesktop/vscode/helloworld.py

hello


留言

這個網誌中的熱門文章

使用VS code開發Python程式 - Matplotlib繪圖

使用Pycharm開發Python程式與用Matplotlib繪圖

[Python][tkinter] Build tkinter GUI 使用tkinter建立圖形視窗