1.Install
- VS Colde
- Anaconda 3
#設定環境變數Path
C:\\ProgramData\\Anaconda3\\
C:\\ProgramData\\Anaconda3\\Scripts
C:\\ProgramData\\Anaconda3\\Library\\bin
- Plugin: Python, vscode-icons
2.Virtual Environment
flowchart LR
G[(Cmd + Shift + P)]:::blue ---> |select| P[(Create Terminal)]:::blue
P ---> |input| B[(conda init)]---> |input| A[(Python Interpreter,conda activate myenv)]
A ---> |install| V1[(pip3 install virtualenv)]
V1 ---> V2[(virtualenv .venv)]
G[(Cmd + Shift + P)]:::blue ---> V3[(Python Select Interpreter)]
V3 ---> |select| P2[(Create Terminal)]:::blue
P2 --> I1[(pip3 install pandas plotly)]
I1 ---> I2[(pip3 freeze)]
G[(Cmd + Shift + P)]:::blue ---> |remove env| R[(rm -rf .venv)]
print('Hello, world!')
執行
python main.py
def writeMessage(message):
print('Message received:', message)
return
writeMessage('This is called from script1.py')
if __name__ == '__main__':
writeMessage('This is called from script1.py')
執行
python script1.py
import script1
script1.writeMessage('This is called from main.py')
執行
python main.py
6.Ref
VSCode 1/5: macOS 最佳 Python 編程工具?豐富的插件商店?Visual Studio Code 安裝攻略 – Python 編程.圖表

