python does not work - python

I always downloaded python from python.org and install it on Windows machines (XP and 8 ) easily. On this Windows XP machine however I have the following problem. After installing python2.7 32 bit on the machine , I cannot start neither the interactive python page nor the python shell ( IDLE or GUI ) ( neither form the Windows Start nor from the command line). I set the path in Windows ( and I double checked and renewed the command line shell as well). From the Windows command line when I type the python -- version, I get the python version, so I assume it is installed. When I simply type python from the command line I get :
ImportError: No module name site
When I try python helloworld.py I get the same error message.
I searched around in FAQ, I seems nobody has such problem. I appreciate any help with this problem.

I suggest that you uninstall the Python with Add or Remove Programs in control panel(link on how to do that below)
http://support.microsoft.com/kb/307895
Then use the first download link on the python website or click the link below:
Python Download

Related

VS returns this when I try to run python /bin/sh: python: command not found (macOS Ventura 13.0.01)

I have installed python as an add-on on VS code. I have also downloaded python from browser so I should have it. Read that it could be because of code runner or wrong path.
The OS I'm running is Ventura 13.0.01
If I press the downward arrow right of the run button in VS it returns my code under the Terminal tab. I've only used JS before this so I really don't know how Python code should run.
I have tried earlier answers that have pointed towards the path direction of Python but didn't understand so much.
if you can check version of python in terminal
python -V
then an can run your code in this way
python /path/to/python_file.py
your question title looks like python was not installed yet or removed.
I'm using Catalina and Big Sur and there is no problems because python is installed from the box.
Python3 now included with Ventura read comments

Cannot Check Installed Python Version in Windows Command Line

I am new to Python, and I an trying to check which version of it I have installed. I remember I installed it a while back, and I do not remember which version I installed back then.
While searching for a way to check my Python version, I came across the following commands that were said to be usable in the Windows command line (I am running Windows 10), so I tried them, but they gave me blank lines as responses and nothing else:
python --version
python -V
Response to the previous lines
Is there another way I can check my Python version?
import platform
print(platform.python_version())
This should do the trick (for Python 3)
Run this from your python IDLE
import sys
print("Python version")
print (sys.version)
I was able to fix the issue by adding Python to my PATH. The instructions from the following website were very useful: https://datatofish.com/add-python-to-windows-path/

what can i do to solve Webots error message

I'm new to webots program and I'm building a new robot controller, but when I hit the start simulation button, it gives me this error :
WARNING: "python3.8.exe" was not found.
Webots requires Python version 3.7 or 2.7 (64 bit) from python.org in your current PATH.
To fix the problem, you should:
1. Check the Python command set in the Webots preferences.
2. Check the COMMAND set in the [python] section of the runtime.ini file of your controller program if any.
3. Fix your PATH environment variable to use the required Python 64 bit version (if available).
4. Install the required Python 64 bit version and ensure your PATH environment variable points to it.
The first thing I recommend to start with is to download Python 3.7. in the documentation https://cyberbotics.com/doc/guide/using-python it is claimed that Webots supports python 3.7 (I think you are using windows). Python 3.8 support is only specified for MacOS and Ubuntu. Download link for Python 3.7: https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe.
When installing, be sure to specify that python should be added to the Path variable (I have circled this field in the figure below with a red rectangle). After installing python, you must restart Webots.
Also using the Windows command line, try running Python using the "python" command, also in the settings in Webots: Tools-Preferences (see the window below) the command that runs Python on your computer is specified. The command to run Python from the command line and the command to run Python specified in Webots-Preferences must match.

Installing pyperclip for Python issues

Following the 'Automate the Boring Stuff' website. Using Windows 10 and Python 3.6.
I am not sure if the problem is to do with my install location of Python itself.
I have followed this post but when following the Environment element of the instructions the Python path isn't showing and I can't add the Python path (unsure as to why).
Python seems to be located at C:\Users\James\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6
If I try and install pyperclip using pip in PowerShell I get the error message "No module named site". I have also tried following various other instructions in order to tell PowerShell where Python is located, but to no avail.

Python IDLE wont' start (Mac) - Problems from a Python/Unix newbie

Months ago, I installed Python 2.7 on my MacBook Pro (OS 10.8.5) and was using IDLE to run programs for classes I was taking on Udacity. One morning IDLE would no longer start, it would just bounce around on the dock and then close. I was eventually able to get things working again by installing Python 3.3 and using that IDLE.
A few days ago, I tried to get 2.7 working again by uninstalling all versions of Python and reinstalling using Macports. (To uninstall, I simply deleted the Python folders in my application folder, the Python.framework file in /Library/Frameworks and some symlinks in /usr/local/bin. Got the idea from another post here: How to uninstall Python 2.7 on a Mac OS X 10.6.4?)
Now no version of Python is working for me. When I try to start IDLE, I get the following error message in the Console:
2/7/14 10:28:02.556 PM com.apple.launchd.peruser.502[151]: ([0x0-0xc80c8].org.python.IDLE[819]) Exited with code: 1
The Python in the terminal still works, by the way. I also tried installing another IDE, PyCharm, but that doesn't work either (I get a message saying No Python interpreter selected)
If you are using a MacPorts Python, you will need to install the corresponding py*-tkinter port to use any Tkinter-based Python app, including IDLE. Try:
sudo port install py27-tkinter

Categories