0

So I have searched this question before, and it's been answered satisfactorily for other users on stackoverflow (Python (Windows) - ImportError: No module named site). stackoverflow says I should avoid asking a question in an answer on that page, and I do not have enough reputation to comment.

So here is the issue (repeated from other question): when I run python, I get the error "ImportError: No module named site"

I installed it as a different user, but with the option to install for all users. That account is privileged (administrators), and when I run python it works just fine. I'm setting up this computer to run a small interface for other users, so want it to run under a normal account that multiple people will have the password for.

This is a Windows 7 box; I completely removed ALL versions of python and installed the latest Python 2.7 (currently 12, as I write this) and PyQt4.

The application runs as a user with admin rights, but doesn't run for the created limited account.

I've reduced the command file to the following:

set PYTHONHOME=C:\Python27
set PYTHONPATH=C:\Python27\lib
set PATH=%PYTHONHOME%;%PATH%
python
pause

I've also tried using quotes around the paths. It is correct - if I run this as the user that installed python, it works. Obviously the issue is not paths or environment variables.

Community
  • 1
  • 1
Fhaab
  • 351
  • 1
  • 2
  • 8
  • Why are you setting PYTHONPATH like that? – user2357112 Jul 19 '16 at 17:40
  • As directed by the answers for the same question that I gave the link to in the first paragraph - I did not do that initially, but wanted to show I followed the answers given when the question was asked previously. It definitely should not be necessary, I know that. I don't set any environment variables if I'm running as the user with admin privileges that installed python, it just works. – Fhaab Jul 20 '16 at 18:16

1 Answers1

1

Here is what i have come up with my search :

Possible causes Squish source build without Python

This typically occurs with Squish source builds that have Python configured.

Solution:

Either set the environment variable PYTHONHOME to the path of the Python libraries, or add an entry similar to this:

Scripting/PythonHome = "C:\\Python26"

in the file SQUISHDIR/etc/paths.ini. Of course, you must put the correct path for your Python installation there. (Note that Squish only supports Python versions 2.4-2.7.)

Python related environment variables

This problem can also occur if the PYTHONHOME variable points to a different Python installation than the one used by Squish.

Solution:

Unset the PYTHONHOME environment variable before starting the Squish IDE (or the squishserver).

this kind of works for me, I hope the same happens to you to :D

source

Ayyoub
  • 4,581
  • 2
  • 19
  • 32