error in creating http server on windows - python

I want to set up Python SimpleHTTPServer on windows XP. I have Python installed on my computer. I am executing the following command:
python -m SimpleHTTPServer 8888
But I am getting the error:
python :
The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Looks like Python is not in your PATH enviroment variable. To fix this try this answer:
https://stackoverflow.com/a/6318188/6400392
Hold Win and press Pause.
Click Advanced System Settings.
Click Environment Variables.
Append ;C:\python27 to the Path variable.
Restart Command Prompt.

Related

Install python using chocolatey on shared windows gitlab runner (powershell)

I'm trying to set up an automatic python build on windows using shared windows runners on gitlab. I am able to install python using chocolatey, but when I try to use python, I get the error:
python -m pip install numpy
The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I have tried using the refreshenv command as recommended here, but it gives me the result
Refreshing environment variables from registry for cmd.exe. This sugests that the powershell profile is not loaded. Ordinarily I would restart the powershell window to reload the profile but I cannot do that in the CI pipeline.
How can I use python in the current powershell window

Launch pycharm from cmd in windows

I can't be able to launch pycham (community version) from the cmd. I also set up the environment variable but still, I am getting this- 'pycharm-community' is not recognized as an internal or external command,
operable program or batch file.
I have used all these commands - charm, charm., pycharm., pycharm. But, I am getting the same problem.
For MS windows:
Find where your pycharm is installed
If it is installed in C:\Program Files\JetBrains\PyCharm\
Type this in cmd:
setx PATH=%PATH%;C:\Program Files\JetBrains\PyCharm\bin
if not, then replace the path to where you pycharm is installed
setx PATH=%PATH%;C:\Path\to\your\pycharm\bin
If this doesn't work, try to restart you system once.
To start pycharm using command, first see what is the file name for executable for pycharm inside the bin folder and use that name. It can be pycharm.exe or something similar.
If it is pycharm.exe, use 'pycharm' in cmd to start it.

Visual Studio Code - Code Runner : 'python' is not recognized as an internal or external command, operable program or batch file

I have installed Visual Studio Code (VSC) and Code Runner.
When I use the terminal to execute my code it works fine and I get the results in the terminal window:
However, when I try to use Code Runner's keyboard shortcut Ctrl+Alt+NI keep getting this error message:
Which baffles me because VSC shows this:
I've tried rebooting (solution on another related SO question), creating a new conda environment inside VSC along with what seemed to be relevant from the VSC documentation here and here.
If anyone can help me understand what I need to be doing differently I would appreciate it.
You need to set a symbolic link between calling Python3 and Python since they're effectively the same thing. If you go into a normal command prompt / terminal and type Python3, you may get the same error. Whereas, if you type Python, it will launch the Python interpreter.
Close VSCode
If you're a Windows user you can use mklink to sort it out — open a Command Prompt as an Administrator, then navigate to your Python installation. e.g.:
cd C:\Python38
mklink python3.exe python.exe
In Linux, you can set a Symbolic link:
cd /usr/bin/python3
ln -s python.exe python3.exe
Startup VSCode again and it should work.

Python Environment Variable Not Working

When I type "Python" into the Windows 10 command prompt I get the error "'python' is not recognized as an internal or external command, operable program or batch file." I've tried adding "C:\Python27" to the "Path" environment variable, but it never works. It doesn't work for the as a user variable or a system variable.
Python might not be in your PATH. Check the environment variables and ensure c:\python27 is in the PATH.

Python: making QRcodes in Windows

I'm new to Python. I'm trying to run this script (gencards.py) in Windows, but he says I need to run "the qrencode command". I assume that means this library, or the more likely the windows port.
In the python script, he uses qrencode as so:
os.system("qrencode -o .tempqr.png -s 30 -m 0 -l H " + serial)
I've installed the windows library via the executable, I added qrcode.exe to PATH, and tried editing gencards.py to use "qrcode" or "qrcode.exe" but I always get
'qrcode' is not recognized as an intrnal or external command, operable program or batch file.
What am I doing wrong?
I'm using Python 2.7 on Windows7 x64.
the error message means that Windows does not know what to do with qrcode. Check if it's installed in your system, and if it's directory is included in your PATH environment variable
Try to break the problem down, by first checking if you can run the programm (btw, is it 'grencode' or 'grcode'?) using a command prompt. If you can't then check your PATH settings again. When you succeeded with the command prompt get back to your python script.

Categories