ÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐÐÈË»ú½»»¥¿ª·¢µÄÍƼöÉèÖÃ
ÔÚlinuxÉÏʹÓÃvisual studio code¾ÙÐÐÈË»ú½»»¥¿ª·¢µÄÍƼöÉèÖÃ
Ëæ×ÅÈ˹¤ÖÇÄܺͻúеѧϰµÄ¿ìËÙÉú³¤£¬ÈË»ú½»»¥¿ª·¢±äµÃÔ½À´Ô½Ö÷Òª¡£¶ø×÷Ϊһ¿î¹¦Ð§Ç¿Ê¢µÄ¿ª·¢¹¤¾ß£¬Visual Studio Code(ÒÔϼò³ÆVS Code)ÔÚÈË»ú½»»¥¿ª·¢ÖÐÊ©Õ¹ÁËÒªº¦×÷Óᣱ¾ÎĽ«ÏÈÈÝÔÚLinuxÉÏʹÓÃVS Code¾ÙÐÐÈË»ú½»»¥¿ª·¢µÄÍƼöÉèÖ㬲¢Ìṩ´úÂëʾÀý¡£
×°ÖÃVS Code
Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃVS Code¡£»á¼ûVS CodeµÄ¹Ù·½ÍøÕ¾£¨https://code.visualstudio.com/£©²¢ÏÂÔØÊÊÓÃÓÚLinuxµÄ×°ÖóÌÐò¡£×°ÖÃÍê±Ïºó£¬·¿ªVS Code¡£
×°ÖÃPython²å¼þ
ÔÚVS CodeÖУ¬PythonÊÇÒ»ÖַǾ³£Óõıà³ÌÓïÑÔ£¬ÌØÊâÊʺÏÈË»ú½»»¥¿ª·¢¡£ÎªÁËʹVS CodeÖ§³ÖPython¿ª·¢£¬ÎÒÃÇÐèҪװÖÃPython²å¼þ¡£ÔÚVS CodeµÄ²à±ßÀ¸ÖУ¬µã»÷¡°À©Õ¹¡±Í¼±ê£¬ËÑË÷²¢×°Öá°Python¡±²å¼þ¡£
ÉèÖÃPythonÇéÐÎ
ÔÚVS CodeÖУ¬ÎÒÃÇÐèҪȷ±£PythonÇéÐÎÉèÖÃ׼ȷ¡£µã»÷VS Code×óϽǵġ°PythonÇéÐΡ±µÄÑ¡ÏѡÔñ׼ȷµÄPythonÚ¹ÊÍÆ÷¡£Äã¿ÉÒÔÑ¡ÔñÈ«¾ÖPythonÚ¹ÊÍÆ÷£¬»òÕßÑ¡ÔñÒ»¸öÐéÄâÇéÐΡ£È·±£ÄãµÄPythonÇéÐοÉÒÔÕý³£ÔËÐС£
×°ÖÃJupyter²å¼þ
JupyterÊÇÒ»¸ö½»»¥Ê½ÅÌËãÇéÐΣ¬ÆÕ±éÓ¦ÓÃÓÚÈË»ú½»»¥¿ª·¢ÖС£ÎªÁËÔÚVS CodeÖÐʹÓÃJupyter£¬ÎÒÃÇÐèҪװÖÃJupyter²å¼þ¡£ÔÚVS CodeµÄÀ©Õ¹À¸ÖÐËÑË÷²¢×°Öá°Jupyter¡±²å¼þ¡£
½¨ÉèJupyterÌõ¼Ç±¾
ÔÚVS CodeÖУ¬ÎÒÃÇ¿ÉÒÔ½¨ÉèJupyterÌõ¼ÇÔÀ´¾ÙÐÐÈË»ú½»»¥¿ª·¢¡£ÔÚVS CodeµÄ²à±ßÀ¸ÖУ¬µã»÷¡°Îļþ¡±->¡°Ð½¨Îļþ¡±£¬²¢½«ÎļþÉúÑÄΪ¡°.ipynb¡±ÃûÌá£ÕâÑù¾Í½¨ÉèÁËÒ»¸öеÄJupyterÌõ¼Ç±¾¡£
±àд´úÂëʾÀý
ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄÈË»ú½»»¥¿ª·¢´úÂëʾÀý£¬Õ¹Ê¾ÁËÔõÑùʹÓÃVS Code¾ÙÐл¥¶¯ÅÌË㣺
# µ¼ÈëËùÐè¿â import numpy as np # ½ç˵һ¸öº¯Êý£¬Æ¾Ö¤ÊäÈëµÄÊý×Ö¾ÙÐмӷ¨ÔËËã def add_numbers(a, b): return a + b # ÊäÈëÁ½¸öÊý×Ö num_1 = float(input("ÇëÊäÈëµÚÒ»¸öÊý×Ö£º")) num_2 = float(input("ÇëÊäÈëµÚ¶þ¸öÊý×Ö£º")) # ŲÓú¯Êý²¢Êä³öЧ¹û result = add_numbers(num_1, num_2) print("Ч¹ûΪ£º", result)
µÇ¼ºó¸´ÖÆ
ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃǵ¼ÈëÁËnumpy¿â£¬½ç˵ÁËÒ»¸ö¼Ó·¨º¯Êý£¬²¢Í¨¹ýinputº¯Êý»ñÈ¡Óû§ÊäÈëµÄÁ½¸öÊý×Ö¡£È»ºó£¬ÎÒÃÇŲÓú¯Êý²¢½«Ð§¹û´òÓ¡³öÀ´¡£
ÔËÐдúÂëʾÀý
ÒªÔÚJupyterÌõ¼Ç±¾ÖÐÔËÐдúÂëʾÀý£¬Ö»Ðèµã»÷ËùÐè´úÂë¿éÅԱߵġ°ÔËÐС±°´Å¥¡£´úÂ뽫ÔÚVS CodeµÄ¼¯³ÉÖÕ¶ËÖÐÖ´ÐУ¬²¢Êä³öЧ¹û¡£
ͨ¹ýÒÔÉÏ°ì·¨µÄÉèÖã¬ÄãÒѾÍê³ÉÁËÔÚLinuxÉÏʹÓÃVS Code¾ÙÐÐÈË»ú½»»¥¿ª·¢µÄÍƼöÉèÖá£VS CodeÌṩÁ˸»ºñµÄ¹¦Ð§ºÍ²å¼þ£¬¿ÉÒÔ´ó´óÌá¸ßÈË»ú½»»¥¿ª·¢µÄЧÂÊ¡£Ï£Íû±¾ÎĶÔÄãÓÐËù×ÊÖú£¡
ÒÔÉϾÍÊÇÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐÐÈË»ú½»»¥¿ª·¢µÄÍƼöÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡