Reputation: 81
I've been trying to get SCons to work on the Windows 10 cmd for some time now. I installed it through pip, so I believe it is in the correct directory because python is working in cmd when I use py
. When I try to use scons
, I get the message
'scons' is not recognized as an internal or external command, operable program or batch file.
Because of that, I tried editing the user and system path variable to include scons under the directory 'C:\Users\dwayn\AppData\Local\Programs\Python38\Lib\site-packages\scons\'
, but I get the same error.
What should I edit to make scons run on the command line?
Note: I do have Anaconda 3 installed on my system if that effects anything.
Upvotes: 8
Views: 16736
Reputation: 1431
It looks like you can only run scons via Python. Various sources are saying look for a .bat or .exe, but I can't find either regardless of installation method (pip, zip, etc.). The only thing that worked for me was:
Install: python install scons
Run: python -m scons
...but I wanted to just be able to type scons
on the command line, so I created an environment variable:
scons
: python -m scons
Restarted the command line and now when I type scons
I get the expected output.
Upvotes: 0
Reputation: 969
Depending on where you get SCons from a wrapper might not be included. In those cases running it via python -m SCons
command should work.
Note it is case sensitive and needs to match the name in the installation folder, which you can display using: python -m pip show scons
Upvotes: 4
Reputation: 846
I had downloaded scons onto my Windows computer by downloading the zip file provided at https://scons.org/pages/download.html . (In my case, this file was named scons-4.2.0.zip). After downloading and unzipping it, I had a 'socns-local-4.2.0' folder in my Downloads folder which contained both scons.bat and scons-4.2.0.bat. (I didn't find any .exe file within the downloaded folder; perhaps this is only produced when users install it via Python.)
To resolve the error message shown in the question, I went to Edit System Environment Variables within the Control Panel (as suggested in earlier answers) and added the scons-4.2.0 folder (located, in my case, at C:\Users<my_username>\Downloads\scons-local-4.2.0) to my system path. (It wasn't necessary to do this for my user path.)
After doing so, I no longer received the error message quoted in the question.
Upvotes: 0
Reputation: 718
I was stuck on this too - quick answer here because the documentation around this area is pretty awful:
pip
and tick 'add python to PATH'pip install scons
in command line. This installs Scons, but it won't be available from command line yetpip show scons
it'll show you where the Scons code actually is (for me it's c:\users\username\appdata\roaming\python\python38\site-packages
- but this is not what you want to add to your pathscons.exe
is located in the Scripts
folder of your python install - so with a generic install of Python 3.8 it would be here: C:\Users\username\AppData\Roaming\Python\Python38\Scripts
- here you should find the scons wrapper
Scripts
folder could be in a variety of places depending on how you installed python, and what version you have - If you can't find it there then also try places like C:\Python27\Scripts
, C:\Program Files (x86)\Python38-32\Scripts
, etcwhere scons
to check if it worked - this should return the filepath to scons.exeYou should now be able to run scons
from command line
Upvotes: 18
Reputation: 21
On my system, I have Python 3.8 installed in C:\Python38
. During the install using the exe installer, I checked the box to add Python to the system path. I then installed scons, which also goes into that location. Running scons didn't work at first (as it had with previous version installs) and I found that the paths that the Python installer added needed to be flipped. It needed to be C:\Python38;C:\Python38\Scripts;%PATH%
. The reason is because scons.bat is in C:\Python38
and scons.py is in C:\Python38\Scripts
. To run scons, it needs to find scons.bat first.
My suggestion is to make sure you have those two paths (wherever they are) in your system environment path such that the path to scons.bat comes first and make sure these come before any paths for other Python installs.
Upvotes: 0
Reputation: 3511
Most likely you need to add:
C:\Users\dwayn\AppData\Local\Programs\Python38\Scripts
to your path.
Upvotes: 0