I have been trying for hours to install SCons on my Windows 8.1 machine and simply cannot. I honestly have no idea whatsoever what I'm doing wrong, or really what I'm doing in general. Here is the step by step process of what I have done
1: installed Python 3.7 from www.python.org I used the python-3.7.3-amd64.exe to install it, it seems to have worked (I have never used python before so if anything is off I wouldn't realize it). When I use the command console and input 'python --version' it outputs 'Python 3.7.3'
2: I downloaded scons-3.0.5.zip from www.scons.org I followed the website's instructions as best I could. I used 7zip to extract it's contents into a new file called 'scons-3.0.5' located at C:\ It's complete path, therefore, is C:\scons-3.0.5
3: I ran Python 3.7 as an admin. I inputted '# cd scons-3.0.5' just as the scons website says to do. It outputted nothing, and I noticed that the new line started with '...' instead of '>>>', I have no previous experience with Python so I don't know if that's good or bad. I then continued to follow the instructions by inputting '# python setup.py install', it outputted nothing, and once more the new line started with '...'. I hoped that was all I needed to do but in the command console I inputted 'scons --version' (I read somewhere this can be done to check if it is installed), it outputs "'scons' is not recognized as an internal or external command, operable program, or batch file.". This, combined with the fact that seemingly nothing is different, leads me to believe it has not been installed.
4: I tried to do something a bit different. I noticed that the zipped file I downloaded from the scons website contained 2 files in it, 1 being scons-3.0.5, the other being pywin32-master.zip, I had both of these in the file C:\scons-3.0.5 I decided to delete that file, and in its same location place the scons-3.0.5 file. Now instead of C:\scons-3.0.5 including scons-3.0.5 and pywin32-master.zip it contained just the contents of the scons-3.0.5 file that was in it before (if that makes sense, I might clean it up in the morning and make it easier to read). I once more did step 3, and the results were no different.
I have no idea what I'm doing, I have no prior experience with Python or the command console, I just want to set up scons and never use Python again. Does anyone know how I can fix this? I have googled for hours but it seems as if I'm the only one who's having this issue.
The contents of the zipped file from scons website:
contents of the scons-3.0.5 file in the zipped file
I doubt the images will help but I have included them just in case if they seem off
edit: I did know what installing via Pip was, but I googled it and it worked just fine! Thanks to Alexander Lopatin and bdbaddog for the help
So you're mistake is in step 3.
I ran Python 3.7 as an admin. I inputted '# cd scons-3.0.5'
The website says:
# cd scons-3.0.5
# python setup.py install
Notice this is
cd into the unzipped directory
THEN run python setup.py install
Instead you've run python, then typed a shell command into python. Which is why you had issues.
Note: On windows you shouldn't need to run as admin to install SCons.
Although as #dirkbaechle said. Pip is the preferred method to install python.
python -mpip install scons
But if you'd rather follow the instructions. Just bring up a windows command shell, or powershell if you like, cd into the unzipped directory, and run python setup.py install
BTW. There's an IRC channel and a users mailing list for SCons support.
https://scons.org/contact.html
Related
I have just started working on my new pc and just to get a feel for it I wanted first to start working on python files, so I started first by just wanting to run WSL on windows and it installed correctly but when I want to run any python using the run python file on the top right on VS code, this is what gets executed $ C:/Users/jaffe/AppData/Local/Microsoft/WindowsApps/python3.10.exe f:/Projects/hello.py
And this is the error: -bash: C:/Users/jaffe/AppData/Local/Microsoft/WindowsApps/python3.10.exe: No such file or directory
I have no idea what's causing it but when I run the file using 'Shift + Enter' which is: Python: Run Selection/Line in Python Terminal it seems to run the single line correctly but it gives me this error instead:
print("Hello, world")
-bash: syntax error near unexpected token `"Hello, world"'
but when I run it using python3 hello.py, it works perfectly fine?! I'm so lost as to why this is happening and how could I fix it.
Might be relevant: I'm using windows 10, installed python 3.10.2 from windows store, all of that is in VS code and the python code is one line: print("Hello, world") and I changed the permissions of Local/Microsoft/WindowsApps so it's now accessible by all users to view/read/edit/run, made sure that python3.10.exe exists(on the WindowsApps and it works perfectly) and reinstalled it many times, tired python3.9, and tried to install python from the website instead of the windows store and still the same, manually added python to PATH and tried .venv and didn't work. when I launch python3.10.exe outside vs code it seems to run perfectly, I have worked with python before and it used to work fine now I don't know what's wrong.
I have seen other questions of the same problem I'm having here but none of them solve the problem.
No such file or directory C:/Users/...
For wsl, the Windows filesystem is accessible, but it has a different path. It is mounted under the /mnt folder. So you would find your python .exe under /mnt/c/Users/jaffe/AppData/Local/Microsoft/WindowsApps/python3.10.exe. This said, the executable file is meant to work on Windows, and it doesn't really makes sense to use it on Linux when you could run python within your wsl distro.
python3 works perfectly fine
This is because most Linux distributions come with python3 pre-installed, so you can use it already. To see where it is located, you can run the command which python3, or python3 --version to check its version.
If you want to change version, you may consider download it from you package manager, apt.
I also suggest to install python3-pip if you don't have it already to get the pip package manager for python.
In my case when I ran into this.. I discovered pyenv. This allows you to download more than one version of python. You can then go into a specific directory, such as your python project and issue a python local 3.10.0 (for example). Here's a link on how to install it as well as poetry which is a virtual environment manager that is become very popular. You can also create an alias for python that works off of this. I add this command to my alias file and source it from my .bashrc. alias python='pyenv exec python3'
On git bash, I receive a command not found message for python, r and nano.
I am on Windows 10. I do not know what I am doing wrong.
I type
r --version
python --version
nano --version
and they all return command not found.
I read something that had me try
alias python='winpty python.exe'
and it renamed python, but when I tried
touch .bashrc
it returned
touch: command not found
I followed the instructions in a Github course, PS239T. I have been fortunate, except for getting these three programs to work.
I tried
build/console.exe c:/Python36/python.exe
and it returned
build/console.exe: No such file or directory
I tried
PATH=$PATH:/c/Python36/
$ export PATH="$PATH:/c/Python36"
echo 'export PATH="$PATH:/c/Python36"' > .profile
and nothing.
I got Python 64-bit via Anaconda.
I tried setting up the Python 3.4 environment
conda create –n py34 python=3.4 anaconda
./python name_of_your_python_script.py
nothing.
which python
got me a huge directory path:
which: no python in (/c/Users/Edward/bin:/mingw64/bin:/usr/local/bin:usr
/bin:/bin:/mingw64/bin:/usr/bin:c/user/Edward/bin:/c/Program Files
(X86)/Intel/ 1CLS client:/c/Program Files/Intel/1CLS Client:/c/Windows
/System32:/C/Windows:/C/Windows/Sytem32/Wbem:/c/Windows/System32
WindowsPowerShell/V1.0:/c/Program Files/Intel/Intel(R) Management Engine
Components/Dal:/c/Program Files/Intel/Intel(R) Management Engine
Components/IPT:/c/Program Files (x86)/Intel/Intel(R) magament Engine
Components/IPT:/c/Program Files (X86)/Intel/Intel(R) Management Engine
Components/IPT:/c/WINDOWS/Syste,32/Wbem:/c/WINDOWS/System32
/WindowsPowerShell/v1.0:/c/Program Files (x86)/Rand McNally/RNDDock
/GtkSharp/2.12/bin/:/c/Program Files d/AppData/Local/Mircosoft
/WindowsApps:/c/Users/Edward/AppData/Local/Pandoc:/usr/bin/vendor_perl:
/usr/bincore_perl:/c/python36
I would have just put up the screenshot or copied and pasted it, but I do not know how.
I am sure I made an error somewhere.
I get the same type of results when I try to figure out what is going on with r and nano.
Update 1
Download and install 'Anaconda'
'https://store.continuum.io/cshop/anaconda/'.
Download the default Python 3 installer 'do not follow the link to version 2'.
Use all of the defaults for installation except make sure to check 'Make Anaconda the default Python.'
Install R by downloading and running
'this .exe file from CRAN'
'http://cran.r-project.org/bin/windows/base/release.htm'.
Also, please install the 'RStudio IDE'
'http://www.rstudio.com/ide/download/desktop'.
All you need is RStudio Desktop.
nano is a basic editor and the default that we use in this class. To install
it, download the Software Carpentry Windows installer
http://files.software-carpentry.org/SWCarpentryInstaller.exe'
and double click on the file to run it. 'This installer requires an active internet connection.'
Sublime Text is a more advanced editor. Download Sublime Text 3 'here'
'https://www.sublimetext.com/3'.
Update 2
I began trying janos advice and ran
/c/Python36/python.exe --version
and it returned
bash: '/c/python36/python.exe: No such file or directory.
I tried to run
PATH="/c/Python36:$PATH" python.exe --version
but it returned
bash: python.exe.: command not found
I tried to run
PATH="/c/Python36:$PATH" python --version
and it returned
bash: python: command not found
Update 3
janos told me I went too far without figuring out the problem, then told me to run
ls -l /c/Python36/python.exe
and it returned
ls: cannot access '/c/Python36/python.exe': no such file or directory.
janos told me to focus on the first error
bash: '/c/python36/python.exe: No such file or directory.
after entering
/c/Python36/python.exe --version
and so there I will focus.
janos asserted
Can you open a file explorer and navigate to C:\Python36, and see python.exe there? Probably not.
and is correct.
I ran
C/Users/Edward/Anaconda3/pkgs/python-3.6.3-h9e2ca53_1/python.exe
with no success.
I ran that in explorer and found that the publisher could not be verified.
Update 4
I went to
'python.org/downloads/release/python-363'
and downloaded 'Windows x86 embeddable zip file' and Unzipped it in
C/Users/Edward/Anaconda3/pkgs
it worked.
Thank you.
I bet I am having the same problems with 'r' and 'nano'.
I am going to run down the list again and perform all the check. I will do the same thing with 'r' and 'nano'.
Everything worked out for Python. I will do 'nano' and 'r' in due course.
I could not find
/c/python36/
so I used
/c/Users/Edward/Anaconda3/pkgs/python-3.6.3-embed-win32/
Update 5
janos is right again. I would need to create the python36 folder as it was not built automatically during the installation. janos' method worked on 'r' and 'subl' or sublime text 3. I gave up on 'nano'.
I found that some of my '.exe' files were in listing with spaces in the names. I moved to the user folder and eliminated any spaces.
I also downloaded version from the official website, and that too helped.
I could not figure out how to get 'nano' to work. I could not even find it on my pc. I used 'subl' instead.
Start from the basics. Try the simplest thing that can possibly work,
and make progress in baby steps,
from one sane state to the next.
The first step is to run a by entering its absolute path directly.
If the Python executable is at /c/Python36/python.exe, then run this:
/c/Python36/python.exe --version
This is very simple and it should just work.
If it doesn't, the command will give you an error message with clues.
A next step could be to simulate adding to PATH. Try this:
PATH="/c/Python36:$PATH" python.exe --version
This is one line. It sets a value to PATH in a way such that it's only active during the execution of the command. After the command completes, the value of PATH will be back to what it was before. This is a good way to test things. Also notice that I prepended to PATH the directory that contains python.exe, not the full path to python.exe.
That's an important point, this is how the PATH variable works.
It's a list of directories, and all executable files in those directories become easily executable by simply typing their name, without having to type their absolute paths.
Next, I would try this:
PATH="/c/Python36:$PATH" python --version
That is, see if you can drop the .exe from the name of the command.
I don't have Windows so I cannot test if this works.
And maybe it doesn't. (But I think it does.)
If everything worked so far, then the next step is to make the PATH setting permanent.
The way to do that is to put the command PATH="/c/Python36:$PATH" into a file that is always executed when you start a new Git Bash session.
If I remember correctly on Windows you can put it in ~/.profile
(a file named .profile in your home directory).
Where is ~? Here's one way to find it:
cd
explorer .
The above opens a file manager inside that directory.
You can use a plain-text editor like Notepad or Wordpad to edit it.
You can also use this shell command to append the line that updates PATH:
echo 'PATH="/c/Python36:$PATH"' >> ~/.profile
This line will get executed in all new Git Bash session.
Not in the current session,
because this file is only executed once.
If everything above worked, then in a new Git Bash session you should be able to run python --version.
If not everything worked, then you need to read the error message you get carefully, and not advance to the next step until the problem is resolved.
It's useless to advance to a next step when you are already not in a sane state.
You can follow the exact same logical process for all the other programs too.
I just installed Python 2.7.10 on windows 10.
I have added my python and pip directory to my PATH like so:
My Scripts folder looks like this:
My problem is, when I type in "pip" in command prompt and press enter absolutely nothing happens, even if I wait several minutes. If I remove the Scripts directory from the PATH variable I just get the error message like "pip not recognized as internal or external command". Python works fine. I have also tried to reinstall both pip and Python but the same problem occurs.
So, does anyone have any idea about why pip does not do anything?
**Edit: ** when I say it does not do anything, I mean the cmd "hangs", like if it is waiting for something to happen. The cursor just keeps on blinking.
One command that is bound to work is writing:
python -m pip install requests
This works because you hand off the script invocation to python, which you know works, instead of relying on the PATH environment variable of windows, which can be dodgy.
Packages like numpy that require c-extensions to be built, will not work with pip unless you have a C Compiler installed on your system. More information can be found in this question.
If you are, as you're saying, unfamiliar with the python environment, then let me assure you, you will have a better day by installing Anaconda.
Anaconda is a completely free Python distribution (including for
commercial use and redistribution). It includes more than 300 of the
most popular Python packages for science, math, engineering, and data
analysis.
Anaconda comes with numpy, of course.
After Python including pip at package, pip commands not work sometimes.
Then you can use pip through python like
python -m pip <pip commands that you want>
Try disabling your virus scanner. If this fixes it, exclude the C:\Python27\ folder from scanning (at your own risk).
I had this same issue: typing pip on the command line just puts the cursor on the next line, and nothing happens. I was sure my PATH system variable had C:\Python27\ and C:\Python27\Scripts\ in it, and I could verify it using echo %PATH% on the command line.
I found that I had to disable my virus scanner (Avast). I excluded the C:\Python27\ from virus scanning, and now everything works. Apparently the scanner is interfering with Python's ability to load the module.
Add the following path or you can also cd to the path and then try pip command, it will work fine.
C:\Python27\Lib\site-packages\pip
I had the same issue after uninstalling my antivirus, which was blocking the script. The issue was resolved.
I have the familiar problem of not being able to install a Python package, pyautogui; "syntax invalid", with install highlighted:
pip install pyautogui
The explanations I've read are all the same, that this code is to be entered into one of the IDLE windows and not the other. Well I've tried both and the result is the same, syntax invalid.
This is Python 3.4.3 on Windows 7.
As #TigerhawkT3 said in the comments, you are supposed to install from CMD, not the Python Shell. pip is an executable that downloads packages.
As the wikipedia page on pip states:
One major advantage of pip is the ease of its command-line interface, which makes installing Python software packages as easy as issuing one command
So pip needs to be run from the command line.
So how do you use pip?
Since you are on Windows 7 the sure-fire way to run it is to open the start menu, type cmd, and click the first result. Then you will be running command prompt, or CMD for short. I suggest that you run pip -h to display the help for more on how to use pip.
If you have
'pip' is not recognized as an internal or external command,
operable program or batch file.
You need to add the path to your scripts folder (the solution is this SO question).
To take an excerpt, you need to execute
setx PATH "%PATH%;C:\Python34\Scripts".
Note that you need to close and re-open CMD for the change to take effect.
Good luck!
EDIT:
For future reference, if you want to set the environment variable, and Setx isn't working, you should search for Edit the system environment variables. Then go to Environment Variables->(in the second list) Path. Then double click that, and append C:\Python34\Scripts;.
I have a program written in python 3.3 that I'd like to be able to distribute without the need for users to install python or any additional modules. I was able to successfully package this program using cx_Freeze on Windows, but the same script on OS X produced an app that wouldn't launch.
I thought I might have better luck using py2app, but now I'm running into a strange problem. The program opens (it has a GUI built with tkinter) and runs flawlessly when built in Alias mode. When I attempt to construct a final build, however, I get the following message in Terminal:
error: No such file or directory: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-2.1-py3.3.egg/_markerlib/__init__.pyc
I navigated to that directory and found a .egg file that I'm unable to open or extract. I've tried reinstalling setup tools and well as python itself with no luck. Has anyone experienced this problem?
It looks like the problem is that your setuptools is somehow broken.
To open the egg file, I tried downloading a third party tool, which crashed, and renaming it as a .zip, which failed. If I just double click on it, I get the "choose default application" popup.
Double-clicking it relies on the extension to decide what app to launch.
The best way to check whether something is a valid zip file is to use the unzip tool from the command line. For example:
$ unzip -t setuptools.egg
This will check all of the zip headers, and check the CRC of all files in the archive, and report any errors. Or, if it's not a zip at all, it'll report one error right at the start.
You can also use the file command to do a quick check to see whether it's some well-known type of file. If file /path/to/setuptools-whatever.egg just says "data" instead of "Zip archive data", then it's probably corrupted beyond recognition.
Anyway, assuming your setuptools didn't come with your Python installation (if you're using a python.org binary installer, it didn't), the safest thing to do is uninstall it, then reinstall it cleanly.
The reason it's important to uninstall first is that the current version will, by default, not install a .egg archive, but will instead install a normal unzipped package and egg-info directory, meaning it may not overwrite the old, broken copy.
The documentation covers uninstalling. Just delete the setuptools .egg file, and anything else named setuptools*, from your site-packages (and anywhere else on your sys.path). If you have distribute there as well, kill that too. This will leave a few files sitting around in other places (notably easy_install-3.3 somewhere on your PATH), but they'll get overwritten properly by the installation, so that's OK.
To install, just follow the usual instructions to reinstall it:
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
… or, if you don't have write access to site-packages:
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python
If you use pip, you may want to reinstall it after reinstalling setuptools, and then pip install -U setuptools pip just to make sure you have the latest versions—and to verify that everything is now working.