Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

python-3.x - 我在哪里可以找到pyc文件?(Where can i find the pyc file?)

The python3 version is Python 3.5.3 in my os.

(python3版本是我的操作系统中的Python 3.5.3。)

mkdir  workspace
cd workspace
vim  print.py
print("i am learning")

Saved and exit.

(保存并退出。)

python3 print.py
i am learning

As far as i knew, python source file was parsed and compiled into pyc file when to execute it.

(据我所知,python源文件被解析并在执行时编译成pyc文件。)

ls
print.py

There is no pyc file in workspace directory,where is the complied print.py file then?

(工作区目录中没有pyc文件,那么print.py文件在哪里?)

sudo find  /  -name  ".pyc"

The find command still can't search pyc file such as print.pyc .

(find命令仍然无法搜索pyc文件,例如print.pyc 。)

python3 -m compileall can create the compiled file for print.py manually,where is the compiled file for print.py created by python itself?

(python3 -m compileall可以创建编译文件print.py手动,其中用于编译的文件print.py Python本身产生的?)
Does python3 delete the print.pyc after executing python3 print.py ?

(是否python3删除print.pyc执行后python3 print.py ?)

  ask by scrapy translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

python3 -m compileall .

(python3 -m compileall。)

To compile all .py files in your current directory.

(编译当前目录中的所有.py文件。)

http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm

(http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...