Changing Python version in Blender?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

volcanoe
Posts: 3
Joined: Sun Sep 16, 2012 1:03 am

Changing Python version in Blender?

Postby volcanoe » Sun Sep 16, 2012 1:23 am

I understand Blender installs its own Python copy. However, I have a few scripts that are referencing certain features that are no longer available in Python 3.x.

So, is it possible to change the default Python version within Blender?

Thanks.

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Sun Sep 16, 2012 7:59 pm

New Blender needs Python 3.2.

Old Blender can use any recent version of Python 2.x.

volcanoe
Posts: 3
Joined: Sun Sep 16, 2012 1:03 am

How exactly?

Postby volcanoe » Sun Sep 16, 2012 8:37 pm

stiv wrote:New Blender needs Python 3.2.

Old Blender can use any recent version of Python 2.x.


thank you for the reply. Can you please be specific on changing the Python version?

On my Mac, i checked the package contents of the Blender.app and located pythin3.2 folder within the python/lib folder. I thought If I replaced it with python2.7 folder, perhaps it would work. Unfortunately, it did NOT.

So, how do you make Blender work with the older pythin version? Do I need to downgrade my Blender to an older version?

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Mon Sep 17, 2012 6:36 pm

Like wise Stiv said, New Blender (2.6x) wants, needs and loves Python 3.2. It feels so strongly about it that nothing else will do.

Old Blender (2.49 and under) can be compiled with pretty much any recent 2.x version of Python. If you want something other than what was released, you need to compile it yourself. Note this is a compile time choice. You cannot compile with one version and then switch to another later.

Old Blender prints a message at startup as to what version of Python it uses. Or look at sys.version.

All versions of Python are available at www.python.org .

volcanoe
Posts: 3
Joined: Sun Sep 16, 2012 1:03 am

2.49b with python 2.7

Postby volcanoe » Thu Sep 27, 2012 7:22 am

Stiv,

I downloaded the old release 2.49b and the readme file says the following: How exactly do you do that? I created that PYTHON variable and i can see its value in Terminal. However, when I launch the Blender, it keeps using Python 2.5

From the readme file: " Even if you do have the right version of Python installed you may need to tell the embedded Python interpreter where the installation is. To do that it's enough to set a system variable called PYTHON to the full path to the stand-alone Python executable (to find out execute "import sys; print sys.executable" inside the stand-alone interpreter, not in Blender). To check which Python was linked to your Blender binary, execute "import sys; print sys.version" at Blender's text editor), it's probably 2.5.something -- only the two first numbers should have to match with yours. "


stiv wrote:Like wise Stiv said, New Blender (2.6x) wants, needs and loves Python 3.2. It feels so strongly about it that nothing else will do.

Old Blender (2.49 and under) can be compiled with pretty much any recent 2.x version of Python. If you want something other than what was released, you need to compile it yourself. Note this is a compile time choice. You cannot compile with one version and then switch to another later.

Old Blender prints a message at startup as to what version of Python it uses. Or look at sys.version.

All versions of Python are available at www.python.org .

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Thu Sep 27, 2012 3:25 pm

However, when I launch the Blender, it keeps using Python 2.5


Blender wants the version of Python it was compiled with. You CANNOT change this after the fact.

You can use environment variables to point to a different installed copy of of the correct version of Python , but usually this is not necessary.

note: Python's internal data structures change size from one version to the next. Blender needs to know this info when it is compiled.


Return to “Python”

Who is online

Users browsing this forum: No registered users and 2 guests