Lordi Lordi
Lordi Lordi

Reputation: 41

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?

Upvotes: 4

Views: 7337

Answers (4)

Shaurya Uppal
Shaurya Uppal

Reputation: 3680

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

Upvotes: 1

Lennart Regebro
Lennart Regebro

Reputation: 172181

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.

Upvotes: 0

Carl Staelin
Carl Staelin

Reputation: 1087

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.

Upvotes: 0

Federico klez Culloca
Federico klez Culloca

Reputation: 27119

Usually a symlink is created in your path called python3.

So you should just need to call your program via

python3 ProgramName.py

Upvotes: 4

Related Questions