sidebar features
sidebar content

Go Back   Blender Artists Forums > General Forums > Python & Plugins

Reply
 
Thread Tools
theeth's Avatar
theeth theeth is offline
Administrator
 
Join Date: Oct 2001
Location: Montreal, Canada
Posts: 10,938
That should have been done ages ago, but anyway...

Ok, so here's how it will work: if you have written some piece of text on how to set the Pythonpath variable or small tricks to instal many versions of Python on the same comp, things like that, just post it here.

Please, only post meaningful and useful information.

Martin
............................................
Life is what happens to you when you're busy making other plans.
- John Lennon
#1   Old 14-Dec-02, 16:41   
Reply With Quote


jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,261
in french but easy to translate with google's tool:
http://cobalt3d.free.fr/didact/pytho...igerlepath.htm
http://jmsoler.free.fr/didacticiel/b...cohabr2pyt.htm

And in this page:
http://jmsoler.free.fr/didacticiel/b...n_script00.htm
look at the F/ paragraph
............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#2   Old 14-Dec-02, 19:30   
Reply With Quote
Enzoblue's Avatar
Enzoblue Enzoblue is offline
Member
 
Join Date: Jun 2002
Location: Pennsylvania, USA
Posts: 1,307
Python Path For Windows 2k and XP, Python20 !!



Install Python in the root of your C. i.e. C:\Python20\

Go to your start button, go up to My Computer and Right click it and go to properties.

Click on the Advanced tab, click on Environment Variables button at the bottom.

Below the System Variables box, (the second box), hit New.

In the Variable Name box, type PYTHONPATH

In the Variable Value box, type this exactly:

C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PY THON20\LIB\LIB-TK

You can copy and paste that.

Hit OK repeatedly.

Reboot.
#3   Old 15-Dec-02, 19:53   
Reply With Quote
theeth's Avatar
theeth theeth is offline
Administrator
 
Join Date: Oct 2001
Location: Montreal, Canada
Posts: 10,938
To set the Pythonpath on XP (or NT 4.0 or Win 2K):
  • go to the Control panel
    double click System
    go to the Advanced tab
    click on Environement Variables

    in the System Variables window
    check if you have a variable named PYTHONPATH

    if you have one already:
    check that it points to the right directories

    if you don't have one already:
    click the New button and create it


try rebooting and restarting Blender so that the internal interpreters registers the new PYTHONPATH


if that doesn't work, there's a fix that can be applied directly in Blender. Be aware that this will not work with script that require the use of dynamic libraries.
  • Open up Blender with the default scene (or use Ctrl-X to get back to it)
    Pull down the Info window at the top
    In the Python button at the left of the screen
    Enter the path to the Lib directory in your Python distro (usually, something like c:/Python22/Lib/)
    Save the user defaults with Ctrl-U

Martin
............................................
Life is what happens to you when you're busy making other plans.
- John Lennon
#4   Old 15-Dec-02, 22:46   
Reply With Quote
eeshlo's Avatar
eeshlo eeshlo is offline
Member
 
Join Date: Mar 2002
Posts: 1,075
I see that I'm repeating a lot here, but here it goes anyway, you can never read this enough times

First, despite that python by now has moved on to version 2.2, Blender currently is still based on python2.01. It is possible to use higher python versions, but if you want full compatibilty, you have to install python2.01.

[color=yellow]UPDATE:[/color][color=orange]
As of Blender version 2.26 (as well as 'funblender') this is no longer true, which were compiled with python2.2, so for these it is best to install python2.2, NOT python2.01.
[/color]


[color=orange]WINDOWS[/color]

1. Get python2.0 from http://www.python.org/2.0.1/
Direct link to the installer(might not work, you might have to use the above link instead):
http://www.python.org/ftp/python/2.0.1/Python-2.0.1.exe

To make sure that python when run from Blender can find the files it needs, you need to set a so-called 'environment variable' which contains all the directories python needs to be able to run properly.

2. PYTHON LIB SHORTCUT:
There is a shortcut to do this, which will make it possible to run most scripts, but not all of them, so it is better to set the PYTHONPATH variable, but if you don't want to do that, you can try this. If you want to set the full pythonpath, skip ahead to part 3.
It is possible to specify the most important python directory in Blender itself, you do that by specifying this in the user-defaults window, this window is hidden away at the top of the main Blender window.
Drag the header downwards to find it, you can also use the windows icon, then selecting the 'i' icon (info-window).
On the left side you will find a button with the name 'Python:', click that, and type the full path to the python lib directory, use the path to wherever you installed python, for me it would be:

Code:
c:\python20\lib
followed by enter, drag the window back (otherwise Blender will always start with this window open), and use CTRL-U key (save user-defaults) and confirm by clicking or using the enterkey to save your settings.
That is all, this will be enough for most scripts.

3. FULL PYTHONPATH:
After installing python and restarting your computer, you will find a new menu entry in the windows 'Start' menu, there is an option called 'python(commandline)', select that, and python will start in a dos-console printing something like this on the screen:

Code:
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>>
The reason for doing this is to find out what directories to add to your PYTHONPATH variable. To do this, type 'import sys' followed by enter. Then 'print sys.path', the result should look something like this:

Code:
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', 'c:\\python20', 'c:\\python20\\dlls', 'c:\\python20\\lib', 'c:\\python20\\lib\\plat-win', 'c:\\python20\\lib\\lib-tk', 'c:\\python20\\pil']
This is what I get, for you it might be different of course, depending on where you installed python. The important directories are the main directory, the 'dlls' directory, and the 'lib' and 'lib-tk' directories.
Any other ones you don't need to add to the environment variable, but you can do that anyway if you want.
Now we need to create an environment variable that contains the same directories.
(btw, To close the python console use 'ctrl-z')
This will depend on what windows version you use, for Win98 for instance you have to add this variable to your autoexec.bat
Open it with notepad for instance, and add the line 'SET PYTHONPATH=' plus the important directories that python printed in the console window as above. So for me it would look like this:

Code:
SET PYTHONPATH=C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PYTHON20\LIB\LIB-TK
Save it, restart your computer, and that should be it.

To set environment variable on Win2000 or WinXP, see the post by Enzoblue or theeth above.


[color=orange]LINUX[/color]
Most if not all distributions already include a version of python, if not, you will have to compile and install it
yourself. As this is not unusual for Linux users, I won't repeat the steps here.

1. To find out what you have to add to your pythonpath, open a shell/terminal and start python (type python or python2.0).
Then type 'import sys' followed by 'print sys.path', which will produce something like this:

Code:
Python 2.0.1 (#5, Jun 21 2002, 22:51:17) [GCC 2.95.3 20010315 (SuSE)] on linux2 Type "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', '/usr/local/lib/python2.0', '/usr/local/lib/python2.0/plat-linux2', '/usr/local/lib/python2.0/lib-tk', '/usr/local/lib/python2.0/lib-dynload', '/usr/local/lib/python2.0/site-packages']
2. There are now several posibilities to add the pythonpath environment variable, depending on what you use, for bash you can add this to your .bashrc file which you will find in your home directory. Open it with an editor and add the following line:

Code:
export PYTHONPATH=/usr/local/lib/python2.0:/usr/local/lib/python2.0/plat-linux2:/usr/local/lib/python2.0/lib-tk:/usr/local/lib/python2.0/lib-dynload:/usr/local/lib/python2.0/site-packages
(I'm not entirely sure about this next bit as for me it is the above)
In case you use a tcsh based shell, you need to add this to .cshrc, in which case it is slightly different:

Code:
setenv PYTHONPATH /usr/local/lib/python2.0:/usr/local/lib/python2.0/plat-linux2:/usr/local/lib/python2.0/lib-tk:/usr/local/lib/python2.0/lib-dynload:/usr/local/lib/python2.0/site-packages
I have found other references on the net that another possibility is adding it to /etc/profile.d, but I'm not a Linux expert, so I can't say much about that.

After you set the pythonpath, log out and back in again to make it active.


For both platforms, a link that might be helpful:
http://www.janw.gothere.uk.com/pythoninstall.html
............................................
There is no excellent beauty that hath not some strangeness in the proportion.

Sir Francis Bacon (1561 - 1626)
#5   Old 16-Dec-02, 00:27   
Reply With Quote
secundar secundar is offline
Member
 
Join Date: Dec 2002
Location: Pittsburgh, USA
Posts: 405
I've tried the linux method but it doesn't seem to work. Mac OS X.2.2, Python 2.2.1, Blender Publisher 2.2.5
#6   Old 27-Dec-02, 22:46   
Reply With Quote
Schlops's Avatar
Schlops Schlops is offline
Member
 
Join Date: Nov 2001
Location: LocX = 8158.2 LocY = 1516.4 LocZ = 9660.9
Posts: 668
For those Linux-freaks who want to put a shortcut on their KDE-/GNOME-Desktop:
Open your favourite texteditor and write down this lil script:
Code:
#!/bin/sh export PYTHONPATH=/the/import/sys/print/sys.path/listelement/from/python/go/here /usr/X11R6/bin/blender
Replace the paths according to your system, the Pythonpath as said above by eeshlo. Name this script as you want e.g. bstart and make it executable (chmod a+x bstart) and put it somewhere in your path e.g. /usr/local/bin (the last step should be done as root).
Now create a desktop-icon (rightclick on desktop -> new... and so on), name it blender. In the properties window for your desktop-icon under Execute -> command (this for KDE, I don't know how this is done in GNOME, but it should work in a similar way) put bstart (maybe you need the full path for that script), switch the Run in terminal checkbox on (KDE, GNOME might be similar) and everything should work fine.
Thanks to Clawz for being the guinea pig
............................................
Stay Rude!
#7   Old 07-Jan-03, 10:49   
Reply With Quote
Hirpo's Avatar
Hirpo Hirpo is offline
Member
 
Join Date: Nov 2002
Posts: 265
I dont completely understand this.. What would i have to type and where, if i were to use Yable and python was installed to e:\Python\ ?
............................................
^__^\'
#8   Old 20-May-03, 11:27   
Reply With Quote
tlustoch's Avatar
tlustoch tlustoch is offline
 
Join Date: Aug 2003
Location: Piestany, Slovakia
Posts: 56
In NT-style Windows (NT, 2K, XP) you do not have to reboot to make the system environment visible to all the apps. Log off and on is enough. It bothers too, as you have to close all the running apps, but it is usually much faster then a full reboot.
#9   Old 08-Aug-03, 12:20   
Reply With Quote
nyoxi nyoxi is offline
 
Join Date: Aug 2003
Posts: 3
Quote:
Originally Posted by tlustoch
In NT-style Windows (NT, 2K, XP) you do not have to reboot to make the system environment visible to all the apps. Log off and on is enough. It bothers too, as you have to close all the running apps, but it is usually much faster then a full reboot.
You even don't need to log off. Just restart the apps you think that they care about the variable.
#10   Old 08-Aug-03, 18:34   
Reply With Quote
toisanji toisanji is offline
 
Join Date: Aug 2003
Posts: 18
how do I set my path in OS X 10.2.6? I have python already installed fomr default os X install. Where would I set the path from? Thanks
#11   Old 12-Aug-03, 14:07   
Reply With Quote
jester71's Avatar
jester71 jester71 is offline
Member
 
Join Date: Sep 2003
Location: Sanremo - Italy
Posts: 149
same problem...
mac osx 10.2.6...
blender 2.25, 2.27 or 2.28a...
python 2.2.3 and 2.3...

need a solution...
#12   Old 06-Sep-03, 18:32   
Reply With Quote
toisanji toisanji is offline
 
Join Date: Aug 2003
Posts: 18
In the beginning of your sscripts, put this:
import sys
sys.path.extend(['', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-darwin', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/pyth
on2.2/site-packages'])
that is 2 lines, first line is "import sys" and the rest is the ssecond line

Quote:
Originally Posted by jester71
same problem...
mac osx 10.2.6...
blender 2.25, 2.27 or 2.28a...
python 2.2.3 and 2.3...

need a solution...
#13   Old 07-Sep-03, 01:21   
Reply With Quote
jester71's Avatar
jester71 jester71 is offline
Member
 
Join Date: Sep 2003
Location: Sanremo - Italy
Posts: 149
I'm still meeting troubles...
an example overall:
makehuman generates an error message on import os

what can I do???
help me please...
and happy blending
#14   Old 08-Sep-03, 15:03   
Reply With Quote
Modron's Avatar
Modron Modron is offline
Member
 
Join Date: Aug 2003
Posts: 10,726
I just set my path according to the instructions given above, ( the post that says to copy and paste if you like ) and I am assuming, (sorry if I sound like a total bone head here) that where it says to type in PYTHON20, I should instead type in PYTHON2.2?
............................................
Here's a nodes tutorial on Using UV mapping to define material values: http://blenderartists.org/forum/showthread.php?t=73088
And here's another nodes tutorial on how to do a custom sequence wipe: http://blenderartists.org/forum/showthread.php?t=90989
#15   Old 18-Sep-03, 20:25   
Reply With Quote
theeth's Avatar
theeth theeth is offline
Administrator
 
Join Date: Oct 2001
Location: Montreal, Canada
Posts: 10,938
Yes, of course. These were examples paths and weren't updated for Python 2.2.3

Martin
............................................
Life is what happens to you when you're busy making other plans.
- John Lennon
#16   Old 18-Sep-03, 20:49   
Reply With Quote
Modron's Avatar
Modron Modron is offline
Member
 
Join Date: Aug 2003
Posts: 10,726
Thanks Theeth!
............................................
Here's a nodes tutorial on Using UV mapping to define material values: http://blenderartists.org/forum/showthread.php?t=73088
And here's another nodes tutorial on how to do a custom sequence wipe: http://blenderartists.org/forum/showthread.php?t=90989
#17   Old 18-Sep-03, 21:03   
Reply With Quote
Burt.S.'s Avatar
Burt.S. Burt.S. is offline
Member
 
Join Date: Aug 2003
Location: Europe
Posts: 826
Quote:
Originally Posted by Schlops
For those Linux-freaks who want to put a shortcut on their KDE-/GNOME-Desktop:
Open your favourite texteditor and write down this lil script:
Code:
#!/bin/sh export PYTHONPATH=/the/import/sys/print/sys.path/listelement/from/python/go/here /usr/X11R6/bin/blender
Great. I'v small question .
What's wrong? When i'm exporting scene from povanim i get error log and script crashes:



[color=red]
Don't know exactly what os ( maybe posix we run but we are runing icon_smile.gif
File "lanc_povanim.py", line 1097, in bevent1...
...line 899, in export_file
...line 10170, in Test_exportVers
...line6495, in writeCamera
AttributeError: 'module' object has no attribute 'atan'
Error Totblck: 7
button string len: 8 0x858c39c
button string len: 8 0x858297c
button string len: 8 0x86d8fa4
button string len: 8 0x858bdc4
button string len: 8 0x858bf04
button string len: 8 0x858bf54
button string len: 384 0x8a3e43c [/color]

Other time at export script crashes because of other attribute.

What's going on?
My python version : 2.2

I'm using blender with dedicated povanim versions, it alvays crashes.

OS: GNU/Linux

Wings works great! At the beginning i was in trouble with erlang and libesdl compilation, but now it works very stable.
............................................
decex.pl
#18   Old 19-Sep-03, 22:02   
Reply With Quote
jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,261
ok, I am writing a version of povanim "special debian users" without math module...

............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#19   Old 20-Sep-03, 22:03   
Reply With Quote
Azolat Azolat is offline
 
Join Date: Sep 2003
Posts: 11
um, I'm a little confused. I went and did Enzoblue's instructions and now what do I do? Is Python supposed to be running when Blender is? Or how do I get these scripts to work now?
#20   Old 25-Sep-03, 18:15   
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 12:40.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Blender Headlines
Featured Artwork
Short animation: Barrel by Phlopper
Woolly mammoth by sebastian_k
Photorealistic classic furniture by eMirage
Social BlenderArtists