Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import failed. Unable to find SCons files: import SCons.Script

this is my first question here and also my first touch with scons. I ran a build from source using the command "sudo python setup.py install --symlink-scons --standard-lib". It seemed to build without errors but failed as follows:

$ scons --version
Import failed. Unable to find SCons files in:
  /usr/local/bin/../engine
  /usr/local/bin/scons-local-2.3.2
  /usr/local/bin/scons-local
  /usr/local/lib/scons-2.3.2
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/scons-2.3.2
  /usr/local/lib/python2.7/site-packages/scons-2.3.2
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scons-2.3.2
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/scons-2.3.2
  /usr/local/lib/scons
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/scons
  /usr/local/lib/python2.7/site-packages/scons
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scons
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/scons
Traceback (most recent call last):
  File "/usr/local/bin/scons", line 190, in <module>
    import SCons.Script
ImportError: No module named SCons.Script

Python version is 2.7.5; running on OS X Mavericks 10.9.4. No file starting with "SCons.Script" is anywhere on the system.

Thanks for your help.

like image 586
ldoanminh Avatar asked Jul 22 '14 20:07

ldoanminh


1 Answers

For me - OS X (darwin) the following has just worked (after wasting days on this problem):

Once scons is installed and not working:

Print python import paths from a python console:

$python
>>import sys
>>print sys.path

Look for the path that ends up with "site-packages". cd there and look for the dir that starts with scons. You shall see at least one dir that looks like this "sons-x.y.z" (version).

cd back to site-packages.

mkdir SCons

Make sure it's empty.

Now copy everything from the original SCons dir to the new one (modify the following line as needed:)

cp -R scons-x.y.z/SCons/ SCons/
like image 59
Vitali Pom Avatar answered Sep 18 '22 09:09

Vitali Pom