亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

個人實踐,如何在vs2017或vs2019中搭建python環(huán)境,并與c#混合

系統(tǒng) 2405 0

本來已經(jīng)安裝了anaconda,不過想更進一步,試試c#與python混合編程。
我記得微軟的vs2017,vs2019已經(jīng)支持了python,如果能用一個IDE搞定全部,自然是最好的。

首先理解vs2017編譯器是怎么支持python的。

① 按照微軟的說法,Visual Studio 的“Python 環(huán)境”窗口(下方為其擴展后的加寬視圖)具有一塊用于管理所有全局 Python 環(huán)境、conda 環(huán)境和虛擬環(huán)境的單獨區(qū)域 。 Visual Studio 可自動檢測出標準位置是否安裝 Python,并且允許用戶配置自定義安裝。 在每個環(huán)境中,用戶都可以輕松管理包、打開該環(huán)境的交互窗口和訪問環(huán)境文件夾。

總結(jié)-----visual studio能當大管家,電腦里安裝了其他python環(huán)境也沒問題。
個人實踐,如何在vs2017或vs2019中搭建python環(huán)境,并與c#混合編程(一)_第1張圖片

Use the Open interactive window command to run Python interactively within the context of Visual Studio. Use the Open in PowerShell command to open a separate command window in the folder of the selected environment. From that command window you can run any python script.
For every Python environment known to Visual Studio, you can easily open the same interactive (REPL) environment for a Python interpreter directly within Visual Studio, rather than using a separate command prompt. You can easily switch between environments as well. (To open a separate command prompt, select your desired environment in the Python Environments window, then select the Open in PowerShell command as explained earlier under Support for multiple interpreters.)

使用“ Open interactive window” 命令,在 Visual Studio 的上下文中以交互方式運行 Python。 使用“open PowerShell 中” 命令,在所選環(huán)境的文件夾中打開單獨的命令窗口。 可從該命令窗口運行任何 python 腳本。

對于 Visual Studio 已知的每個 Python 環(huán)境,用戶都可以直接在 Visual Studio 中輕松打開 Python 解釋器的實時交互 (REPL) 環(huán)境,而無需使用單獨的命令提示符。 也可以輕松地切換環(huán)境。 (若要打開單獨的命令提示符,請在“Python環(huán)境”窗口中選擇所需的環(huán)境,然后如之前的對多個解釋器的支持下所述,選擇“在 PowerShell 中打開”命令)
個人實踐,如何在vs2017或vs2019中搭建python環(huán)境,并與c#混合編程(一)_第2張圖片

總結(jié)-----微軟提供了兩個交互方式,一個叫做interactive window,這是一種實時交互環(huán)境,能隨時查看運行結(jié)果,變量的值。
另一種叫做 PowerShell 命令行窗口,這是單獨用來執(zhí)行任何py程序的。

Visual Studio also provides tight integration between the Python code editor and the Interactive window. The Ctrl+Enter keyboard shortcut conveniently sends the current line of code (or code block) in the editor to the Interactive window, then moves to the next line (or block). Ctrl+Enter lets you easily step through code without having to run the debugger. You can also send selected code to the Interactive window with the same keystroke, and easily paste code from the Interactive window into the editor. Together, these capabilities allow you to work out details for a segment of code in the Interactive window and easily save the results in a file in the editor.
Visual Studio also supports IPython/Jupyter in the REPL, including inline plots, .NET, and Windows Presentation Foundation (WPF).

Visual Studio 還緊密集成了 Python 代碼編輯器與Interactive window。 使用 Ctrl +Enter 鍵盤快捷方式可將編輯器中的當前代碼行(或代碼塊)發(fā)送給交互 窗口,然后移至下一行(或塊),Ctrl +Enter 無需運行調(diào)試程序即可輕松單步執(zhí)行代碼。 你也可以使用相同的鍵盤快捷方式將選定代碼發(fā)送給Interactive window,并輕松地將Interactive window中的代碼粘貼到編輯器中。 將這些功能結(jié)合使用可以在Interactive window中找出代碼段的詳細信息,并將結(jié)果輕松保存到編輯器的文件中。

總結(jié):Ctrl +Enter功能很牛X。

Visual Studio helps you manage the complexity of a project as it grows over time. A Visual Studio project is much more than a folder structure: it includes an understanding of how different files are used and how they relate to each other. Visual Studio helps you distinguish app code, test code, web pages, JavaScript, build scripts, and so on, which then enable file-appropriate features. A Visual Studio solution, moreover, helps you manage multiple related projects, such as a Python project and a C++ extension project.

Visual Studio 可幫助管理項目隨時間增加的復雜性。 Visual Studio 項目不僅僅是一個文件夾結(jié)構(gòu):它包括理解不同文件的使用方式以及文件之間的關系。 Visual Studio 可幫助用戶區(qū)分應用代碼、測試代碼、網(wǎng)頁、JavaScript 和生成腳本等,從而啟用文件對應的功能。 此外,Visual Studio 解決方案還可以幫助用戶管理多個相關的項目,例如 Python 項目和 C++ 擴展項目。
個人實踐,如何在vs2017或vs2019中搭建python環(huán)境,并與c#混合編程(一)_第3張圖片
總結(jié): 發(fā)揮ide的優(yōu)勢,能系統(tǒng)的管理項目,具備很多內(nèi)置的模板,項目和項模板可自動完成不同類型的項目和文件的設置過程,能為用戶節(jié)省寶貴的時間,無需管理錯綜復雜又容易出錯的細枝末節(jié)。

⑤司空見慣的智能提示,全面的 Python 調(diào)試,使用基于 CPython 的解釋器時,可以在 Visual Studio 中評估 Python 代碼的性能。

以及Linting 檢查,Python 代碼中的錯誤和常見問題,鼓勵使用好的 Python 編碼模式。
為 Python 創(chuàng)建的許多庫都是用 C++ 編寫的,旨在獲得最佳性能。 Visual Studio 提供了豐富的用于開發(fā) C++ 擴展的工具,包括混合模式調(diào)試。
總結(jié):所以c++與python在vs中能很好的結(jié)合?這個還沒研究過,而linting在anaconda中沒有?

缺點: 因為python通常是一種解釋型語言目前,Visual Studio 本身不提供創(chuàng)建獨立可執(zhí)行文件的方法,它本質(zhì)上是一個具有嵌入式 Python 解釋器的程序。另外,Visual Studio 中的 Python 支持不包括用于 UI 開發(fā)的任何特定工具。
我記得沒錯的話,python的UI一直是弱項,沒有也無所謂。


更多文章、技術交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 免费国产精品视频 | 色综合久久综合欧美综合网 | 色婷婷精品综合久久狠狠 | 久久九九有精品国产56 | 桃子在线观看 | 2021国产精品自产拍在线观看 | 我想看一级黄色毛片 | 免费国产精成人品 | 日操夜操天天操 | 成人欧美日韩高清不卡 | 大学生不戴套毛片视频 | 成人永久免费高清 | 涩久久| 99久久做夜夜爱天天做精品 | 深夜在线网站 | 成人精品视频一区二区在线 | 免费观看国产一区二区三区 | 影音先锋在线亚洲精品推荐 | 福利视频网页 | 日本猛妇色xxxxx在线 | 色妇色综合久久夜夜 | 色综合久久天天综线观看 | 国产一区二区三区在线观看精品 | 免费人成在线观看网站品爱网 | 欧美激情视频网址 | 97久草 | 中文字幕久精品免费视频蜜桃视频 | 97国产在线视频 | 四虎影永久在线观看精品 | 亚洲欧美成人网 | 综合好色| 激情综合五月亚洲婷婷 | 日韩中文字幕一区 | 亚洲五月激情 | 亚洲视频污 | 国内视频精品 | 色老头成人免费视频天天综合 | 国产自愉怕一区二区三区 | 亚洲狠狠婷婷综合久久久久网站 | 香蕉久久夜色精品国产2020 | 亚洲国产欧洲精品路线久久 |