簡體   English   中英

如何讓VSCode的終端識別python

[英]How to get VSCode's terminal to recognize python

我剛剛開始學習 python,這是我的第一個項目。 我正在嘗試為一個簡單的游戲編寫一個機器人,並嘗試在 vs 代碼底部的終端中運行一個命令,以檢查 pyautogui 是否正確安裝在我的工作區中。 我可以從我的計算機終端執行“pip list”,我從列表中看到 pyautogui 但 vscode 終端 window 說

The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct, and try again.

在行:1 字符:1

  • pip列表
  •  + CategoryInfo: ObjectNotFound: (pip:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException

感謝您的反饋

VScode 使用虛擬環境,因此您必須從 VScode 安裝模塊。

嘗試使用 pip3 而不是 pip(如果您使用 python3.x)。 否則嘗試使用“python get -pip.py”安裝 pip。

這在我之前發生過幾次,我相信這是 Windows 中的路徑問題。 因此,解決此問題的最簡單方法是讓 Anaconda 為您完成。

Go 這個鏈接: https://www.anaconda.com/products/individual#windows

然后,單擊下載按鈕。 下載后,安裝程序會詢問您是否要讓 Anaconda 修改您的路徑,說是。 讓 anaconda 進行所需的更改。

然后,重新啟動您的 Visual Studio 代碼並再次嘗試 pip。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM