Can there be a conflict between two different version of python ?

I have a program that needs access to Python 2.6, I have a environment variable setup, so the program that needs access to a subfolder of the Python 2.6 installation is suppose to access via this environment variable;

The program is not accessing the sub-folder of Python 2.6 ?

In environment variable Path,you should add root folder and scripts folder of python26.
This is what you add to Path

Test it out in cmd(command line) type python.
Now running program pythnon will use python26 and install modules with setuptools,pip will find and install to python26.
python install
pip install somepackage

Edited 3 Years Ago by snippsat

I added the semi-colen before the python path that I need the program to access, the program is not finding the path in the system variable ?

I don't understand what I should test out in a python command, a python script ? If so I did try a python script within python cmd, I got an error ?

I added the semi-colen before the python path that I need the program to access, the program is not finding the path in the system variable ?

I think you are mixing the understanding of environment variable and PYTHONPATH.
Environment variable you set so Windows find the Python version you use.
PYTHONPATH is the path Python search for Python code/programs.

To se where Python search you can do this.

>>> import sys
>>> print sys.path
#Here you get a list of all folder python search for code(PYTHONPATH)
#If you have a .py in one of this folders Python will find it

I don't understand what I should test out in a python command

No you should test python command out in command line for OS called cmd
Here how it look for me when i type in python in cmd.

Microsoft Windows [Versjon 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Med enerett.


Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
Type "help", "copyright", "credits" or "license" for more information.

If environment variable is set up correct you can type python anywhere in cmd(command line) and Python will start.
So to sum it up Environment variable is so that windows can find Python.
PYTHONPATH is where Python search for Python code(.py).

Edited 3 Years Ago by snippsat

What your saying is if print sys.path can't find the modules subfolder in the Python 26 then something is wrong. That is why the program is unable to find it ?

Yes Python only find code in PYTHONPATH.
There are some solutions,you can move your "modules subfolder" to a folder in PYTHONPATH.
Usually all Python modules/code get placed in C:\Python26\Lib\site-packages

You can append to PYTHONPATH.

import sys

The only bad ting with this solution is that is not permanent.

To permanently add to PYTHONPATH,you can do this.
Search for,if you dont find it make it in C:\Python26\Lib\site-packages
In this file add this.
import sys

Restart Python.
Now see if your C:\path\to\module are in print sys.path.

An other option is just to make .pth file in site-packages folder.
In that file just add C:\path\to\module

Edited 3 Years Ago by snippsat

I created the file and witin this file I entered the path to the modules, restarted the computer. Then I ran 'import sys' followed by 'print sys' and in the list I couldn't find my modules path ? I did find out I had (2) files, one that you told me to create, the other in my software, that I can't edit.

No one else has experienced a headache, it just works when they place the correct modules in the right sub-folder.

Doesn't a environment variable dig into sub-folders to find what it needs ? For example if I have
C:\python\modules\; in my envorinment variable and there is a subfolder called 'acme' will it dig for the scripts within 'acme' or stop searching ?

No only listed directories are checked. Of course the directory can be package and then it is imported normally.

If it's suppose to check only listed directories, does it search for sub-directories / folders. I could reinstall everything, I want to solve it without going that route, it sounds simple to solve, yet it's not solved.

This article has been dead for over six months. Start a new discussion instead.