I want to install python 2.7 to my computer, but I have a problem. I've already installed that .msi file from the python official website and now I have a folder C:\Python27 . I've set up environmental variables(system variables) like this: ....;C:\Python27;C:\Python27\Tools\Scripts After I've restarted my computer I type to the command window 'python' but It sais:
'python' is not recognized as an internal or external command, operable program or batch file.
Checkout this link
Python is not added to the DOS path by default. This screencast
will walk you through the steps to add the correct entry to the System
Path, allowing Python to be executed from the command-line by all
users.
To add Python to system variables: (Computer > Advanced System Settings > Environment Variables) You would goto your cmd instance, and put in PATH = C:/Python27/
Related
'django-admin' is not recognized as an internal or external command,
operable program or batch file... So I am getting this error in terminal. I am trying to build an app. First I opened a folder(page) in my computer D drive and then opened Visual Studio Code. From there I opened the folder(page) and from view I opened terminal. Then when I am trying to type django-admin myproject page. it is showing this error.
As you are using conda environment, use conda activate to activate the environment, and then you can use the Django module.
This error is occurring due to the missing Django module.
If you're using a virtual environment, do you have it activated?
Is you you python scripts folder in PATH?
On windows: Search for 'Edit the system environment variables'.
Click on 'Environment Variables...'
In System Variables look for row with variable name Path. Click on it and then Edit.
You'll see a number of directories. Do you see one ending with something like ..\Python\Python39\Scripts?
If you have that folder open it and make sure you have django-admin.exe inside.
I wanted to use pypy to make my python scripts faster.
I downloaded the zip file form the website and unzipped it in the C drive. I have python 3 (32bit) and Microsoft Visual C++ 2017 Redistributable(x86) installed. I've added the path to the directory containing pypy3.exe to my PATH.
When I try to run a script, for example: pypy app.py I get a message saying "'pypy' is not recognized as an internal or external command, operable program or batch file."
How can I fix this?
You should try to use pypy3 instead of pypy if you have downloaded pypy for python 3. This can be confirmed by looking inside the unzipped folder where you can see whether you have pypy3.exe or pypy.exe.
If that doesn't solve your issue, you need to ensure that the folder, where you unzipped pypy, is already in windows PATH environment variable. I am assuming you are using windows 10, in command line type the following:
echo $PATH
If you can't pypy folder in the PATH, add it using the command line:
setx PATH=%PATH%;C:\location\of\pypy
where you need to use the location of pypy folder. For example, if location of your pypy folder is C:\pypy, type the following command:
setx PATH=%PATH%;C:\pypy
You may need to restart your cmd for the changes to take effect.
I trying to run a program in python 3 that uses numpy but it gives me the error ModuleNotFoundError: No module named 'numpy'. I am using Windows 10. I tried running pip install numpy and it says pip is not a recognized command
You need to add python to your environment variables
Computer -> System Properties (or Win+Break) -> Advanced System Settings
Click the Environment variables button (in the Advanced tab)
Edit PATH and append ;C:\Python27 to the end (if you need substitute your Python version)
Click OK. Note that changes to the PATH are only reflected in command prompts opened after the change took place.
If you are running python 3.6 you will need to add python to your environment path through command prompt
Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.
To temporarily set environment variables, open Command Prompt and use the set command:
set PATH=C:\Program Files\Python 3.6;%PATH%
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
These changes will apply to any further commands executed in that console and will be inherited by any applications started from the console.
To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
If you were to run python -v it should now work
This came directly from the python documents section 3.3.1
Now after you restart you should be able to access python through the command line. If you are running 2.7.9+ or 3.4+ pip will come prepackaged with python. However, if you are running an earlier version of python
Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:
Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:
python get-pip.py
You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).
Thanks to How do I install pip on Windows?
Add "way to folder with your python interpreter" and "way to folder with your python interpreter"\Scripts\ to PATH variable. Computer -> Properties -> Extra options -> Environment variables.
I have Installed Python 3.4 onto a new PC. Python works but I am trying to get pip to work on this. I have made a path for Python which is below.
C:\Python34\python.exe
When i run the below code
C:\Windows\System32>pip install python-docx
'python' is not recognized as an internal or external command,
operable program or batch file.
It seems that you haven't configured your PATH variable correctly. In order to do so:
Hold down the Win key and press Pause.
Click Advanced System Settings.
Click Environment Variables.
Append ;C:\Python34 to the PATH variable.
Restart Command Prompt.
(You may also just run set PYTHONPATH=%PYTHONPATH%;C:\Python34 in the cmd)
Further information is available in The Official Python Installation Guide for Windows.
I have installed the Enthought Python distribution on my computer, but I don't have any idea how to use it. I have PyLab and IDLE but I want to run .py files by typing the following command:
python fileName.py
I don't know where to write this command: IDLE, PyLab or Python.exe or Windows command prompt. When I do this in IDLE it says:
SyntaxError: invalid syntax
Please help me to figure this out.
Open a command prompt: Press ⊞ Win and R at the same time, then type in cmd and press ↵ Enter
Navigate to the folder where you have the ".py" file (use cd .. to go one folder back or cd folderName to enter folderName)
Then type in python filename.py
Indeed, the command to run a Python file should be run in the command prompt. Python should be in your path variable for it to work flexible.
When the python folder is added to path you can call python everywhere in the command prompt, otherwise just in your python install folder.
The following is from the python website:
Windows has a built-in dialog for changing environment variables
(following guide applies to XP classical view): Right-click the icon
for your machine (usually located on your Desktop and called “My
Computer”) and choose Properties there. Then, open the Advanced tab
and click the Environment Variables button.
In short, your path is:
My Computer ‣ Properties ‣ Advanced ‣ Environment Variables In this
dialog, you can add or modify User and System variables. To change
System variables, you need non-restricted access to your machine (i.e.
Administrator rights).
Another way of adding variables to your environment is using the set
command in a command prompt:
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
If you do it via My Computer, then look for the line named path in Enviroment Variables. Give that the value of your Python installation folder.
Set PYTHON variable to point to the full path of python.exe.
Then type in command prompt console window:
C:\path_to_folder\ python filename.py