By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,585 Members | 1,795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,585 IT Pros & Developers. It's quick & easy.

Re: Are .pyc files portable?

P: n/a
Python compiles to bytecode, which means that pyc files can be
interpreted by any Python executable regardless of platform.

As for manual compilation to directories, the py_compile module is the
one you want. Here's an example program to plug in.

#test_compile.py#

import py_compile

print "hello"
py_compile.compile("test_compile.py", "C:\test_compile.pyc")
The manual page for py_compile.compile() can be found on this page:
http://www.python.org/doc/2.5.2/lib/...pycompile.html

Hope that helps.
Cheers,
Wubbulous
Nov 8 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 07 Nov 2008 19:01:31 -0800, Wubbulous wrote:
Python compiles to bytecode, which means that pyc files can be
interpreted by any Python executable regardless of platform.
No, bytecode isn't compatible from one version number to another.

--
Steven
Nov 8 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.