开发者

How to run a program with python 3.x

I use ubuntu 10.10, and I have both Python 2.x and Python 3.x. I have a program that needs to run with python 3.x (blender 2.5x).

How do I run a开发者_如何转开发 program with python 3.x?


Usually a symlink is created in your path called python3.

So you should just need to call your program via

python3 ProgramName.py


Installation

sudo apt-get install python3

Even after installing python3, python 2.7 will stay and be default

Now, the way to run python3 code->

Method 1

Run python3 Now write the code

Method2

Run a save sample.py file

python3 sample.py


Do you have a separate python executable for python 2.x and for python 3.x? On my system I have /usr/bin/python2.5 and /usr/bin/python2.6. I also have a /usr/bin/python2, which is a symbolic link to /usr/bin/python2.6. I presume that you have a /usr/bin/python3 too. In which case, you simply run the program using /usr/bin/python3 instead of the more generic /usr/bin/python.

I hope this helps.


Blender is not run with or through Python at all. It's a native compiled executable and runs directly. It does however embed Python and use it as a scripting language. Blender 2.5 uses Python 3, and for this to work you need Python 3 installed on your system in the path, so blender can find it.

That's all, afaik.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜