×ðÁú¿­Ê±

ÔÚLinuxϵͳÉÏʹÓÃPyCharm¾ÙÐлúеѧϰµÄÉèÖÃÒªÁì

ÔÚlinuxϵͳÉÏʹÓÃpycharm¾ÙÐлúеѧϰµÄÉèÖÃÒªÁì

¼ò½é£º

PyCharmÊÇÒ»¿îºÜÊÇÊ¢ÐеÄPython¼¯³É¿ª·¢ÇéÐΣ¨IDE£©£¬ËüÌṩÁËÇ¿Ê¢µÄ´úÂë±à¼­ºÍµ÷ÊÔ¹¦Ð§£¬Ê¹µÃ¿ª·¢Ö°Ô±Äܹ»¸ü¸ßЧµØ±àдºÍά»¤´úÂë¡£¹ØÓÚѧϰºÍ¿ª·¢»úеѧϰËã·¨µÄÈËÀ´Ëµ£¬PyCharmÊÇÒ»¸öºÜÊǺõÄÑ¡Ôñ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉÏÉèÖÃPyCharmÀ´Ö§³Ö»úеѧϰµÄ¿ª·¢ÊÂÇé¡£

°ì·¨Ò»£º×°ÖÃPythonºÍPyCharm

Ê×ÏÈ£¬ÐèҪװÖÃPythonºÍPyCharm¡£ÔÚLinuxϵͳÉÏ£¬¿ÉÒÔͨ¹ý°ü¹ÜÀíÆ÷À´×°ÖÃPython¡£·­¿ªÖնˣ¬²¢ÔËÐÐÒÔÏÂÏÂÁ

sudo apt-get install python3

µÇ¼ºó¸´ÖÆ

Õ⽫װÖÃPython3.5»ò¸ü¸ß°æ±¾¡£Çë×¢ÖØ£¬Python2.x½«ÔÚ2020Äê×èÖ¹Ö§³Ö£¬Òò´Ë½¨ÒéʹÓÃPython3.x°æ±¾¡£

×°ÖÃÍê³Éºó£¬¿ÉÒÔ´ÓJetBrains¹ÙÍø£¨https://www.jetbrains.com/pycharm/£©ÏÂÔز¢×°ÖÃPyCharm¡£

°ì·¨¶þ£º½¨ÉèPyCharmÏîÄ¿

·­¿ªPyCharm£¬Ê×ÏÈÐèÒª½¨ÉèÒ»¸öÐÂÏîÄ¿¡£ÔÚÖ÷²Ëµ¥ÖУ¬Ñ¡Ôñ”File” -> “New Project”¡£ÔÚµ¯³öµÄ´°¿ÚÖУ¬Ñ¡ÔñÏîÄ¿µÄ·¾¶²¢ÃüÃûÏîÄ¿¡£

°ì·¨Èý£ºÉèÖÃPythonÚ¹ÊÍÆ÷

ÔÚÐÂÏîÄ¿½¨ÉèÀֳɺ󣬻¹ÐèÒªÉèÖÃPyCharmʹÓÃ׼ȷµÄPythonÚ¹ÊÍÆ÷¡£ÔÚ”Project Interpreter”ÉèÖÃÖУ¬Ñ¡ÔñÒÑ×°ÖõÄPythonÚ¹ÊÍÆ÷¡£ÈôÊÇÎÞ·¨ÕÒµ½Ú¹ÊÍÆ÷£¬Çëµ¥»÷”Show All¡­”°´Å¥£¬²¢ÊÖ¶¯Ö¸¶¨Ú¹ÊÍÆ÷·¾¶¡£È·±£Ñ¡ÔñµÄÚ¹ÊÍÆ÷Óë֮ǰװÖõİæÄÚÇéÆ¥Åä¡£

°ì·¨ËÄ£º×°ÖÃËùÐèµÄPython°ü

ÔÚ»úеѧϰ¿ª·¢ÖУ¬¾­³£Ê¹ÓÃÐí¶àPython°ü£¬ÈçNumPy¡¢Pandas¡¢Scikit-learnµÈ¡£PyCharmÌṩÁËÒ»ÖÖ¼òÆӵķ½·¨À´×°ÖÃÕâЩ°ü¡£ÔÚ”Project Interpreter”ÉèÖÃÖУ¬µã»÷ÓÒ²àµÄ”+”·ûºÅ£¬ËÑË÷²¢Ñ¡ÕªÒª×°Öõİü£¬È»ºóµã»÷”Install Package”°´Å¥¾ÙÐÐ×°Öá£

°ì·¨Î壺ÉèÖÃPyCharmµÄ±à³ÌÇéÐÎ

PyCharmÌṩÁËÇ¿Ê¢µÄ´úÂë±à¼­ºÍµ÷ÊÔ¹¦Ð§£¬¿ÉÒÔ´ó´óÌá¸ß±à³ÌЧÂÊ¡£ÔÚ”Editor”ÉèÖÃÖУ¬¿ÉÒÔ¾ÙÐÐһЩ¸öÐÔ»¯µÄÉèÖã¬Èç×ÖÌå¡¢Ëõ½øµÈ¡£

°ì·¨Áù£ºÊ¹ÓÃʾÀý´úÂë¾ÙÐлúеѧϰ

ÏÂÃ棬ÎÒÃǽ«Ê¹ÓÃÒ»¸ö¼òÆӵĻúеѧϰʾÀýÀ´ÑÝʾÔÚPyCharmÖоÙÐлúеѧϰ¿ª·¢µÄÀú³Ì¡£ÎÒÃǽ«Ê¹ÓÃScikit-learn¿âÀ´ÊµÏÖÒ»¸öÏßÐԻعéÄ£×Ó¡£

Ê×ÏÈ£¬ÔÚÏîÄ¿Öн¨ÉèÒ»¸öеÄPythonÎļþ£¬ÃüÃûΪ”linear_regression.py”¡£

ÔÚÎļþÖУ¬µ¼ÈëÐëÒªµÄ¿â²¢×¼±¸Êý¾Ý£º

import numpy as np
from sklearn.linear_model import LinearRegression

# ×¼±¸Êý¾Ý
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3

µÇ¼ºó¸´ÖÆ

½ÓÏÂÀ´£¬½¨ÉèÒ»¸öÏßÐԻعéÄ£×Ó¹¤¾ß£¬²¢¾ÙÐÐѵÁ·ºÍÕ¹Íû£º

# ½¨ÉèÄ£×Ó¹¤¾ß
model = LinearRegression()

# ѵÁ·Ä£×Ó
model.fit(X, y)

# Õ¹ÍûЧ¹û
X_test = np.array([[3, 5]])
y_pred = model.predict(X_test)

print(y_pred)

µÇ¼ºó¸´ÖÆ

×îºó£¬Ö´ÐдúÂë²¢Éó²éЧ¹û¡£ÔÚPyCharmÖУ¬¿ÉÒÔͨ¹ýµã»÷”Run”°´Å¥»òʹÓÿì½Ý¼ü£¨ÈçCtrl+Shift+F10£©À´ÔËÐгÌÐò¡£

×ܽ᣺

±¾ÎÄÏÈÈÝÁËÔõÑùÔÚLinuxϵͳÉÏÉèÖÃPyCharmÀ´¾ÙÐлúеѧϰµÄ¿ª·¢¡£Í¨¹ýƾ֤ÉÏÊö°ì·¨×°ÖúÍÉèÖÃPyCharm£¬¿ª·¢Ö°Ô±¿ÉÒÔ¸üÀû±ãµØ±àдºÍµ÷ÊÔ»úеѧϰ´úÂ롣ͬʱ£¬ÍŽáÇ¿Ê¢µÄ±à¼­¹¦Ð§ºÍ¸»ºñµÄPython¿â£¬PyCharmΪ»úеѧϰ¿ª·¢ÌṩÁËÒ»¸öÍêÕûµÄ½â¾ö¼Æ»®¡£

ÒÔÉϾÍÊÇÔÚLinuxϵͳÉÏʹÓÃPyCharm¾ÙÐлúеѧϰµÄÉèÖÃÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿