ผมลองเขียน

print "Hello Boy"

ใน text editor แล้วเซฟเป็น hello.py อ่ะครับ ไม่ทราบว่าเวลาจะรันทำไงอ่ะครับ

ผมรองรันใน terminal ว่า

python program_hello.py

มันก็ขึ้นว่า python: can't open file 'program_hello.py': [Errno 2] No such file or directory

ผมใช้ ubuntu ครับ อยากถามว่าทำไมมันรันไม่ได้ครับ แล้วต้องทำไง

ถึงจะรันได้อ่ะครับ

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

bow_der_kleine Mon, 12/01/2009 - 21:40

interpreter มันหาไฟล์ program_hello.py ไม่เจอครับ ลองเชคดูว่าเขียนชื่อไฟล์ถูกหรือเปล่า หรือสั่งรันถูก directory หรือเปล่า

BioLawCom.De

cwt Tue, 13/01/2009 - 23:49

เซฟเป็น hello.py อ่ะครับ

แต่

python program_hello.py

มันก็ไม่เจอสิครับ ต้องสั่งว่า python hello.py สิ

risc Wed, 14/01/2009 - 09:47

ถ้าอยากรันง่ายก็ลองใช้ spe แล้วกด รันได้ครับ ถ้าไม่อยากรันผ่าน terminal แต่ถ้าเกิด รันผ่าน terminal ก็อย่างที่พี่สองท่านว่าแหละครับ เข้าไปใน directory ที่เก็บไฟล์ไว้ แล้วพิมพ์ python ตามด้วยชื่อไฟล์.py ผลก็ออกมาครับ

แสวงหามิใช่เพราะรอคอย เชี่ยวชาญมิใช่เพราะโอกาส ชำนาญมิใช่เพราะโชคช่วย"ดังนี้แล้วลิขิตฟ้าหรือจะสู้มานะตน"chonlatee

bow_der_kleine Sat, 17/01/2009 - 18:44

In reply to by lnwbleach

ลอง SPE หรือยังครับ หากใช้ Ubuntu ง่ายใหญ่เลย ติดตั้งด้วยคำสั่ง

$ apt-get install spe

แล้วก็เปิดขึ้นมาด้วยคำสั่ง

$ spe

เวลาจะรันไฟล์ก็เซพไฟล์ก่อน แล้วกดปุ่มรันซึ่งอยู่ตรง tool bar ก็เรียบร้อยครับ

BioLawCom.De

cwt Sat, 17/01/2009 - 18:26

สงสัยต้องไปเริ่มจากการทำความเข้าใจ Linux ก่อนมั้ง เรื่อง file, directory, shell, permission, mode, flag ถ้ายังคิดจะใช้ base OS เป็น Ubuntu

เห็นด้วยครับ จขกท ลองอ่านเอกสาร Shells and Utilities ดูครับ

จริง ๆ หากเป็น average user ไม่ต้องรู้ก็ได้ครับ แต่หากต้องเขียนโปรแกรมไม่รู้ไม่ได้เลย

BioLawCom.De

mementototem Sun, 18/01/2009 - 16:03

ทำให้ไฟล์ run ได้ด้วย chmod (+x คือ อนุญาตให้ execute ได้)

chmod +x hello.py

แล้วเรียกโดย ( ./ คือ dir ปัจจุบัน)

./hello.py

ทำความเข้าใจเรื่อง command-line ให้ดี ก็ดีแล้วครับ ถ้าคิดจะใช้ linux
แนะนำอีกเว็บครับ LinuxCommand.org

lnwbleach Mon, 19/01/2009 - 20:27

ขอบคุณครับ เวลานี้ผมคงต้องศึกษา linux ให้มากกว่านี้แล้วล่ะครับ แล้วค่อยศึกษาไพธอน

lnwbleach Wed, 21/01/2009 - 20:32

ตอนนี้รันได้แล้วครับ ที่รันไม่ได้เพราะผมเอาไฟล์นั้นไว้ที่ Desktop เลยมีคนแนะนำว่า

พอเข้า Terminal แล้วให้พิมพ์ cd ~/Desktop ก่อน แล้วค่อย python hello.py

เป็นอันว่าได้แล้วครับ และขอบคุณทุกท่านมากนะครับ