Cov txheej txheem:

Kuv yuav muab Python scripts Linux nyob qhov twg?
Kuv yuav muab Python scripts Linux nyob qhov twg?

Video: Kuv yuav muab Python scripts Linux nyob qhov twg?

Video: Kuv yuav muab Python scripts Linux nyob qhov twg?
Video: Installing Jupyter Notebook on Ubuntu! 2024, Kaum ib hlis
Anonim

2 Teb. Kom paub meej, yog tias qhov kev pab cuam no tsuas yog muaj rau hauv paus, ces lub ntsiab ua haujlwm python tsab ntawv yuav tsum mus rau /usr/sbin/. Config cov ntaub ntawv yuav tsum mus rau /etc/, thiab teev cov ntaub ntawv rau /var/log/. Lwm yam python cov ntaub ntawv yuav tsum tau xa mus rau /usr/share/pyshared/.

Kuj paub, Kuv yuav sau ntawv python li cas hauv Linux davhlau ya nyob twg?

Hauv Linux

  1. Tsim ib daim nplaub tshev hauv koj lub computer siv rau koj cov kev pabcuam Python, xws li ~ / pythonpractice, thiab txuag koj xyz. py program hauv folder..
  2. Qhib qhov kev pab cuam terminal.
  3. Ntaus cd ~/pythonpractice los hloov cov npe rau koj li pythonpractice folder, thiab ntaus Enter.
  4. Ntaus python./xyz.py los khiav koj qhov program!

Tom qab ntawd, lo lus nug yog, Kuv yuav ua li cas thiaj li khiav Python tsab ntawv los ntawm kab hais kom ua? Khiav koj tsab ntawv

  1. Qhib kab hais kom ua: Pib ntawv qhia zaub mov -> Khiav thiab ntaus cmd.
  2. Hom: C:python27python.exe Z:codehw01script.py.
  3. Los yog yog tias koj lub kaw lus raug teeb tsa kom raug, koj tuaj yeem rub thiab tso koj tsab ntawv los ntawm Explorer mus rau qhov Command Line window thiab nias nkag.

Ib yam li ntawd, Python puas tuaj yeem siv hauv Linux?

Python yog ntsia los ntawm lub neej ntawd ntawm tag nrho cov loj Linux kev faib tawm. Qhib kab hais kom ua thiab ntaus ntawv python tam sim ntawd yuav poob koj rau hauv a Python tus txhais lus. Python yog ib hom lus programming tag nrho. Code rov siv tau yooj yim, vim Python modules yooj yim ua tau yuav import thiab siv hauv ib qho Python tsab ntawv.

Kuv yuav khiav Python tsab ntawv los ntawm qhov twg?

Txhawm rau ua kom Python scripts khiav tau los ntawm txhua qhov chaw hauv qab Windows:

  1. Tsim cov npe los tso tag nrho koj cov ntawv python hauv.
  2. Luam tag nrho koj cov ntawv python rau hauv phau ntawv no.
  3. Ntxiv txoj hauv kev rau phau ntawv teev npe no hauv Windows "PATH" qhov sib txawv:
  4. Khiav lossis rov pib dua "Anaconda Prompt"
  5. Ntaus "your_script_name.py"

Pom zoo: