Команда python в командной строке не работает windows

When I type python into the command line, the command prompt says python is not recognized as an internal or external command, operable program, or batch file. What should I do? Note: I have Python...

I have installed the latest Python for Win10 from Releases for Windows.
Just typing py in the Command Prompt Window starts Python.

Microsoft Windows [Version 10.0.15048]
(c) 2017 Microsoft Corporation. All rights reserved.

C:Userssg7>py
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>`enter code here`

Testing:

>>> print("hello!")
hello!
>>>

Please be aware that in my case Python was installed in C:Userssg7AppDataLocalProgramsPythonPython36> directory

C:Userssg7AppDataLocalProgramsPythonPython36>dir
 Volume in drive C is Windows7_OS
 Volume Serial Number is 1226-12D1

 Directory of C:Userssg7AppDataLocalProgramsPythonPython36

08/05/2018  07:38 AM    <DIR>          .
08/05/2018  07:38 AM    <DIR>          ..
12/18/2017  09:12 AM    <DIR>          DLLs
12/18/2017  09:12 AM    <DIR>          Doc
12/18/2017  09:12 AM    <DIR>          include
12/18/2017  09:12 AM    <DIR>          Lib
12/18/2017  09:12 AM    <DIR>          libs
10/03/2017  07:17 PM            30,334 LICENSE.txt
10/03/2017  07:17 PM           362,094 NEWS.txt
10/03/2017  07:15 PM           100,504 python.exe
10/03/2017  07:12 PM            58,520 python3.dll
10/03/2017  07:12 PM         3,610,776 python36.dll
10/03/2017  07:15 PM            98,968 pythonw.exe
08/05/2018  07:38 AM           196,096 Removescons.exe
08/05/2018  07:38 AM            26,563 scons-wininst.log
08/05/2018  07:38 AM    <DIR>          Scripts
12/18/2017  09:12 AM    <DIR>          tcl
12/18/2017  09:12 AM    <DIR>          Tools
06/09/2016  11:53 PM            87,888 vcruntime140.dll
               9 File(s)      4,571,743 bytes
              10 Dir(s)  20,228,898,816 bytes free

When I am at C:Userssg7> directory level python can be invoked by typing
AppDataLocalProgramsPythonPython36python

C:Userssamg>AppDataLocalProgramsPythonPython36python
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Newer Python 3.7 will be installed at:
C:UsersYourUserNameHereAppDataLocalProgramsPythonPython37

If you wish you can add to your path environment variable:
%USERPROFILE%AppDataLocalProgramsPythonPython36

I’m trying to -learn to write and- run Python scripts on my Windows 7 64 bit machine. I installed Python in C:/Python34, and I added this to my Windows’ PATH variable :

C:Python34; C:Python34python.exe

(the second one is probably meaningless but I tried) and still I get this error in Windows command line :

C:Usersme>python test.py
'python' is not recognized as an internal or external command,
operable program or batch file.

So how do I truly install Python on my Windows x64 machine ?

asked Jun 12, 2014 at 14:22

jeff's user avatar

2

This might be trivial, but have you tried closing your command line window and opening a new one? This is supposed to reload all the environment variables.
Try typing

echo %PATH%

into the command prompt and see if you can find your Python directory there.

Also, the second part of your addition to the PATH environment variable is indeed unnecessary.

answered Jun 12, 2014 at 14:28

yossim's user avatar

yossimyossim

2761 silver badge5 bronze badges

7

I had the same problem: python not being recognized, with python in the path which was was not truncated.

Following the comment of eryksun in yossim’s answer:

Also, if you installed for all users you should have %SystemRoot%py.exe, which >is typically C:Windowspy.exe. So without setting Python’s directory in PATH >you can simply run py to start Python; if 2.x is installed use py -3 since >Python 2 is the default. – eryksun

I tried to use py instead of python and it worked.
Meaning:
python setup.py build -> does NOT work.
py setup.py build -> does work.
Hope it helps

Josef Ginerman's user avatar

answered Sep 21, 2017 at 14:17

senis000's user avatar

senis000senis000

2312 silver badges6 bronze badges

3

I was also having the same problem.

Turns out the path I added included ‘..python.exe’ at the end, which as turns out was not required. I only needed to add the directory in which ‘python.exe’ is in (which in my case is the Anaconda’s distribution directory in Users folder), similar to what we do when installing JDK in our system’s PATH variable.

Hope it helps!

answered Jul 29, 2018 at 4:54

Arnab Roy's user avatar

Arnab RoyArnab Roy

1751 silver badge7 bronze badges

It wasn’t working for me even after adding the path. What finally did the trick, was changing the order of listed paths in the PATH variable. I moved %USERPROFILE%AppDataLocalMicrosoftWindowsApps down vs. having it the first path listed there.

vvvvv's user avatar

vvvvv

21k17 gold badges46 silver badges66 bronze badges

answered Apr 3, 2022 at 6:50

uditgt's user avatar

uditgtuditgt

1111 silver badge1 bronze badge

2

Environment PATH Length Limitation is 1024 characters

If restarting your cmd window does not work you might have reached the character limit for PATH, which is a surprisingly short 1024 characters.

Note that the user interface will happily allows you to define a PATH that is way longer than 1024, and will just truncate anything longer than this. Use

echo %PATH%

in your cmd window to see if the PATH being truncated.

Solution

Unfortunately, there is no good way to fix this besides removing something else from your PATH.


NOTE: Your PATH = SYSTEM_PATH + USER_PATH, so you need to make sure the combined is < 1024.

Community's user avatar

answered Jun 12, 2014 at 15:00

bcorso's user avatar

bcorsobcorso

44.8k9 gold badges62 silver badges75 bronze badges

1

Also, make sure to leave no spaces after the semi-colon.

For example, this didn’t work for me:
C:Windowssystem32; C:Python27; C:Python27Scripts;

But, this did:
C:Windowssystem32;C:Python27;C:Python27Scripts;

answered Mar 29, 2018 at 17:21

nihal111's user avatar

nihal111nihal111

3483 silver badges9 bronze badges

2

I did everything:

  • Added Python to PATH
  • Uninstall all the Pythons — Both from downloaded python.org and Microsoft Store and reinstall from python.org
  • Change the order of PATH
  • Deleted %USERPROFILE%AppDataLocalMicrosoftWindowsApps from PATH

But nothing worked. What worked for me was:
Settings > Application > App execution aliases. Then disable all the Pyhtons from here and it worked!
App execution aliases

answered Dec 2, 2022 at 14:05

tatoline's user avatar

tatolinetatoline

2254 silver badges9 bronze badges

I’m late to the game here, but I’d like to share my solution for future users. The previous answers were on the right track, but if you do not open the CMD as an administrator, then you will be thrown that same error. I know this seems trivial and obvious, but after spending the past 8 hours programming before attempting to install Django for the first time, you might be surprised at the stupid mistakes you might make.

answered Jan 30, 2015 at 17:40

David Schilpp's user avatar

I have faced same problem even though my path contains 400 characters.
Try to update the path from the command line(Run as administrator)

Command to update path: setx path «%path%;c:examplePath»

After this command I could see that paths that I configured earlier in environment variables got updated and working.

To check the configured paths: echo %PATH%

answered Jul 4, 2019 at 6:23

Manikanta Vasupalli's user avatar

1

I was facing similar porblem. What helped me is where command.

C:WINDOWSsystem32>where python
C:UsersxxxxxxxAppDataLocalMicrosoftWindowsAppspython.exe
C:Program Files (x86)Microsoft Visual
StudioSharedPython39_86python.exe

On updating PATH variable to point to only one desired directory (basically I removed %USERPROFILE%AppDataLocalMicrosoftWindowsApps from PATH) fixed my problem.

answered Mar 31, 2022 at 8:00

Manojkumar Khotele's user avatar

I had the same issue with Python 2.7 on Windows 10 until I changed the file path in Enviroment Variables to the folder path, ie C:Python27python.exe didn’t work but C:Python27 did work.

answered Oct 31, 2018 at 12:33

Nick W's user avatar

Nick WNick W

8411 gold badge14 silver badges28 bronze badges

For me, installing the ‘Windows x86-64 executable installer’ from the official python portal did the trick.

Python interpreter was not initially recognized, while i had installed 32 bit python.
Uninstalled python 32 bit and installed 64 bit.

So, if you are on a x-64 processor, install 64bit python.

answered Mar 11, 2019 at 15:42

dev ip's user avatar

I tried it multiple times with the default installer option, the first one, (Python 3.7.3) with both ‘add to environment variable’ and ‘all users’ checked, though the latter was greyed out and couldn’t be unchecked.

It failed to work for other users except for the user I installed it under until I uninstalled it and chose «Custom Install». It then clearly showed the install path being in the C:Program FilesPython37 directory when it was failing to install it there the other way even though the ‘All Users’ option was checked.

answered May 16, 2019 at 1:08

mindmischief's user avatar

Same thing was happening with me when i was trying to open the python immediately with CMD.

Then I kept my in sleep mode and started CMD using these Key Windows_key+R, typed cmd and OK. Then the package of python worked perfectly.

Matthew's user avatar

Matthew

1,8673 gold badges17 silver badges25 bronze badges

answered Jun 20, 2019 at 9:15

Creepy Creature's user avatar

  1. Uninstall python and pyqt
  2. Then go to pyqt setup and open installation but don’t install. You will see a message box saying something like pyqt version built with python version 32bit/64bit.
  3. Then see python version bit and download that version from python.org from all release menu.
  4. Then first install python and then install pyqt. It will work like butter.

Mohannad A. Hassan's user avatar

answered Nov 30, 2019 at 23:41

Mark S. Khalil's user avatar

I spent sometime checking and rechecking the path and restarting to no avail.

The only thing that worked for me was to rename the executable C:Python34python.exe to C:Python34python34.exe. This way, calling typing python34 at the command line now works.

On windows it seems that when calling ‘python’, the system finds C:Python27 in the path before it finds C:Python34

I’m not sure if this is the right way to do this, seems like a hack, but it seems to work OK.

answered Jan 8, 2015 at 18:41

maulynvia's user avatar

1

I’m trying to -learn to write and- run Python scripts on my Windows 7 64 bit machine. I installed Python in C:/Python34, and I added this to my Windows’ PATH variable :

C:Python34; C:Python34python.exe

(the second one is probably meaningless but I tried) and still I get this error in Windows command line :

C:Usersme>python test.py
'python' is not recognized as an internal or external command,
operable program or batch file.

So how do I truly install Python on my Windows x64 machine ?

asked Jun 12, 2014 at 14:22

jeff's user avatar

2

This might be trivial, but have you tried closing your command line window and opening a new one? This is supposed to reload all the environment variables.
Try typing

echo %PATH%

into the command prompt and see if you can find your Python directory there.

Also, the second part of your addition to the PATH environment variable is indeed unnecessary.

answered Jun 12, 2014 at 14:28

yossim's user avatar

yossimyossim

2761 silver badge5 bronze badges

7

I had the same problem: python not being recognized, with python in the path which was was not truncated.

Following the comment of eryksun in yossim’s answer:

Also, if you installed for all users you should have %SystemRoot%py.exe, which >is typically C:Windowspy.exe. So without setting Python’s directory in PATH >you can simply run py to start Python; if 2.x is installed use py -3 since >Python 2 is the default. – eryksun

I tried to use py instead of python and it worked.
Meaning:
python setup.py build -> does NOT work.
py setup.py build -> does work.
Hope it helps

Josef Ginerman's user avatar

answered Sep 21, 2017 at 14:17

senis000's user avatar

senis000senis000

2312 silver badges6 bronze badges

3

I was also having the same problem.

Turns out the path I added included ‘..python.exe’ at the end, which as turns out was not required. I only needed to add the directory in which ‘python.exe’ is in (which in my case is the Anaconda’s distribution directory in Users folder), similar to what we do when installing JDK in our system’s PATH variable.

Hope it helps!

answered Jul 29, 2018 at 4:54

Arnab Roy's user avatar

Arnab RoyArnab Roy

1751 silver badge7 bronze badges

It wasn’t working for me even after adding the path. What finally did the trick, was changing the order of listed paths in the PATH variable. I moved %USERPROFILE%AppDataLocalMicrosoftWindowsApps down vs. having it the first path listed there.

vvvvv's user avatar

vvvvv

21k17 gold badges46 silver badges66 bronze badges

answered Apr 3, 2022 at 6:50

uditgt's user avatar

uditgtuditgt

1111 silver badge1 bronze badge

2

Environment PATH Length Limitation is 1024 characters

If restarting your cmd window does not work you might have reached the character limit for PATH, which is a surprisingly short 1024 characters.

Note that the user interface will happily allows you to define a PATH that is way longer than 1024, and will just truncate anything longer than this. Use

echo %PATH%

in your cmd window to see if the PATH being truncated.

Solution

Unfortunately, there is no good way to fix this besides removing something else from your PATH.


NOTE: Your PATH = SYSTEM_PATH + USER_PATH, so you need to make sure the combined is < 1024.

Community's user avatar

answered Jun 12, 2014 at 15:00

bcorso's user avatar

bcorsobcorso

44.8k9 gold badges62 silver badges75 bronze badges

1

Also, make sure to leave no spaces after the semi-colon.

For example, this didn’t work for me:
C:Windowssystem32; C:Python27; C:Python27Scripts;

But, this did:
C:Windowssystem32;C:Python27;C:Python27Scripts;

answered Mar 29, 2018 at 17:21

nihal111's user avatar

nihal111nihal111

3483 silver badges9 bronze badges

2

I did everything:

  • Added Python to PATH
  • Uninstall all the Pythons — Both from downloaded python.org and Microsoft Store and reinstall from python.org
  • Change the order of PATH
  • Deleted %USERPROFILE%AppDataLocalMicrosoftWindowsApps from PATH

But nothing worked. What worked for me was:
Settings > Application > App execution aliases. Then disable all the Pyhtons from here and it worked!
App execution aliases

answered Dec 2, 2022 at 14:05

tatoline's user avatar

tatolinetatoline

2254 silver badges9 bronze badges

I’m late to the game here, but I’d like to share my solution for future users. The previous answers were on the right track, but if you do not open the CMD as an administrator, then you will be thrown that same error. I know this seems trivial and obvious, but after spending the past 8 hours programming before attempting to install Django for the first time, you might be surprised at the stupid mistakes you might make.

answered Jan 30, 2015 at 17:40

David Schilpp's user avatar

I have faced same problem even though my path contains 400 characters.
Try to update the path from the command line(Run as administrator)

Command to update path: setx path «%path%;c:examplePath»

After this command I could see that paths that I configured earlier in environment variables got updated and working.

To check the configured paths: echo %PATH%

answered Jul 4, 2019 at 6:23

Manikanta Vasupalli's user avatar

1

I was facing similar porblem. What helped me is where command.

C:WINDOWSsystem32>where python
C:UsersxxxxxxxAppDataLocalMicrosoftWindowsAppspython.exe
C:Program Files (x86)Microsoft Visual
StudioSharedPython39_86python.exe

On updating PATH variable to point to only one desired directory (basically I removed %USERPROFILE%AppDataLocalMicrosoftWindowsApps from PATH) fixed my problem.

answered Mar 31, 2022 at 8:00

Manojkumar Khotele's user avatar

I had the same issue with Python 2.7 on Windows 10 until I changed the file path in Enviroment Variables to the folder path, ie C:Python27python.exe didn’t work but C:Python27 did work.

answered Oct 31, 2018 at 12:33

Nick W's user avatar

Nick WNick W

8411 gold badge14 silver badges28 bronze badges

For me, installing the ‘Windows x86-64 executable installer’ from the official python portal did the trick.

Python interpreter was not initially recognized, while i had installed 32 bit python.
Uninstalled python 32 bit and installed 64 bit.

So, if you are on a x-64 processor, install 64bit python.

answered Mar 11, 2019 at 15:42

dev ip's user avatar

I tried it multiple times with the default installer option, the first one, (Python 3.7.3) with both ‘add to environment variable’ and ‘all users’ checked, though the latter was greyed out and couldn’t be unchecked.

It failed to work for other users except for the user I installed it under until I uninstalled it and chose «Custom Install». It then clearly showed the install path being in the C:Program FilesPython37 directory when it was failing to install it there the other way even though the ‘All Users’ option was checked.

answered May 16, 2019 at 1:08

mindmischief's user avatar

Same thing was happening with me when i was trying to open the python immediately with CMD.

Then I kept my in sleep mode and started CMD using these Key Windows_key+R, typed cmd and OK. Then the package of python worked perfectly.

Matthew's user avatar

Matthew

1,8673 gold badges17 silver badges25 bronze badges

answered Jun 20, 2019 at 9:15

Creepy Creature's user avatar

  1. Uninstall python and pyqt
  2. Then go to pyqt setup and open installation but don’t install. You will see a message box saying something like pyqt version built with python version 32bit/64bit.
  3. Then see python version bit and download that version from python.org from all release menu.
  4. Then first install python and then install pyqt. It will work like butter.

Mohannad A. Hassan's user avatar

answered Nov 30, 2019 at 23:41

Mark S. Khalil's user avatar

I spent sometime checking and rechecking the path and restarting to no avail.

The only thing that worked for me was to rename the executable C:Python34python.exe to C:Python34python34.exe. This way, calling typing python34 at the command line now works.

On windows it seems that when calling ‘python’, the system finds C:Python27 in the path before it finds C:Python34

I’m not sure if this is the right way to do this, seems like a hack, but it seems to work OK.

answered Jan 8, 2015 at 18:41

maulynvia's user avatar

1

When I type ‘python’ at the command line it says »python’ is not recognized as an internal or external command…’

I have Python in both User and System paths. In the past I have been able to run python from the command line, but suddenly today I can’t.

I’m using Windows 7 32-bit.

Does anyone know what the problem could be?

Thanks

asked Jun 23, 2013 at 9:42

4

This could be a duplicate answer, but the following steps has worked for me.

Note: This is in the case of Anaconda is installed instead of vanilla Python in Windows environment.

Under System variables:

  1. Create a variable

PYTHONHOME = C:UsersusernameAnaconda3

  1. Add the below 2 entries under PATH system variable:

%PYTHONHOME%

C:UsersusernameAnaconda3Scripts

  1. Close the command prompt if opened earlier and try any python command
    (Note: no need to restart the OS):

example: python —version
output: Python 3.7.1

Hope this was useful. Cheers!

answered Mar 27, 2019 at 15:31

Shyamsundar MS's user avatar

The python install directory on Windows should have the following files (ignore the pyscopg and pillow files):

Python directory listing

Your PATH environment variable should be like the below if you have install Python2 at the default location:

PATH=%PATH%;C:Python27;C:Python27Scripts

You should also have the following in PATHEXT:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

I noticed in your environment variables you have Python27Scripts; which is not correct. Try fixing that, and you’ll have to close any command prompts if you change any environment variables. If the settings are as the above and you still can’t run Python, do a re-install.

answered Jun 23, 2013 at 10:35

Burhan Khalid's user avatar

1

Lets assume that you installed python in the default location.

try adding this into your system environments.

name : PYTHONPATH
value: C:Python27;C:Python27Lib;C:Python27include;C:Python27DLLs;C:Python27Scripts;C:Python27Libsite-packages

Note: when you create a PYTHONPATH environment variable it might effect some other application to forcefully use this version of python instead their own.

answered Jun 23, 2013 at 9:50

abhishekgarg's user avatar

1

This seems to be a problem in the PATH environment variable. To confirm that, in cmd try the following:

If you are using Python 2.7:

SET PATH=%PATH%;C:Python27

If you are using Python 3.3:

SET PATH=%PATH%;C:Python33

And then: python something

answered Jun 23, 2013 at 9:49

Saullo G. P. Castro's user avatar

2

python is clearly NOT in your PATH variable. You can confirm this by looking at the output of echo %path%.

Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.

Another possibility is that you added the wrong path to the PATH variable. Verify it.

The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.

answered Jun 23, 2013 at 9:52

janos's user avatar

janosjanos

3,2171 gold badge20 silver badges31 bronze badges

2

Try closing the command prompt window and opening again, then trying. Worked for me.

user's user avatar

user

29.1k11 gold badges99 silver badges144 bronze badges

answered Jun 13, 2015 at 18:14

AtariBaby's user avatar

AtariBabyAtariBaby

1331 silver badge3 bronze badges

Most common mistake!!

Developers forget to set this «C:Python27» in PATH variable assuming «C:Python27Lib» is enough.

Both path should be present

answered Dec 9, 2015 at 5:54

Siva-Dev-Wizard's user avatar

When I type ‘python’ at the command line it says »python’ is not recognized as an internal or external command…’

I have Python in both User and System paths. In the past I have been able to run python from the command line, but suddenly today I can’t.

I’m using Windows 7 32-bit.

Does anyone know what the problem could be?

Thanks

asked Jun 23, 2013 at 9:42

4

This could be a duplicate answer, but the following steps has worked for me.

Note: This is in the case of Anaconda is installed instead of vanilla Python in Windows environment.

Under System variables:

  1. Create a variable

PYTHONHOME = C:UsersusernameAnaconda3

  1. Add the below 2 entries under PATH system variable:

%PYTHONHOME%

C:UsersusernameAnaconda3Scripts

  1. Close the command prompt if opened earlier and try any python command
    (Note: no need to restart the OS):

example: python —version
output: Python 3.7.1

Hope this was useful. Cheers!

answered Mar 27, 2019 at 15:31

Shyamsundar MS's user avatar

The python install directory on Windows should have the following files (ignore the pyscopg and pillow files):

Python directory listing

Your PATH environment variable should be like the below if you have install Python2 at the default location:

PATH=%PATH%;C:Python27;C:Python27Scripts

You should also have the following in PATHEXT:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

I noticed in your environment variables you have Python27Scripts; which is not correct. Try fixing that, and you’ll have to close any command prompts if you change any environment variables. If the settings are as the above and you still can’t run Python, do a re-install.

answered Jun 23, 2013 at 10:35

Burhan Khalid's user avatar

1

Lets assume that you installed python in the default location.

try adding this into your system environments.

name : PYTHONPATH
value: C:Python27;C:Python27Lib;C:Python27include;C:Python27DLLs;C:Python27Scripts;C:Python27Libsite-packages

Note: when you create a PYTHONPATH environment variable it might effect some other application to forcefully use this version of python instead their own.

answered Jun 23, 2013 at 9:50

abhishekgarg's user avatar

1

This seems to be a problem in the PATH environment variable. To confirm that, in cmd try the following:

If you are using Python 2.7:

SET PATH=%PATH%;C:Python27

If you are using Python 3.3:

SET PATH=%PATH%;C:Python33

And then: python something

answered Jun 23, 2013 at 9:49

Saullo G. P. Castro's user avatar

2

python is clearly NOT in your PATH variable. You can confirm this by looking at the output of echo %path%.

Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.

Another possibility is that you added the wrong path to the PATH variable. Verify it.

The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.

answered Jun 23, 2013 at 9:52

janos's user avatar

janosjanos

3,2171 gold badge20 silver badges31 bronze badges

2

Try closing the command prompt window and opening again, then trying. Worked for me.

user's user avatar

user

29.1k11 gold badges99 silver badges144 bronze badges

answered Jun 13, 2015 at 18:14

AtariBaby's user avatar

AtariBabyAtariBaby

1331 silver badge3 bronze badges

Most common mistake!!

Developers forget to set this «C:Python27» in PATH variable assuming «C:Python27Lib» is enough.

Both path should be present

answered Dec 9, 2015 at 5:54

Siva-Dev-Wizard's user avatar

prim0

a53e06407f7f46df82d99b9f6184b52a.PNG3513624638ff4f809b8aa04a94af49a3.PNG


  • Вопрос задан

    более трёх лет назад

  • 15939 просмотров


Комментировать


Решения вопроса 2

saboteur_kiev

Saboteur

@saboteur_kiev Куратор тега Python

software engineer

А собственно сам питон вы на комп устанавливали?
Где находится python.exe можете показать?

Пригласить эксперта


Ответы на вопрос 3

RusTech

pyton как и piton не запустятся с командной строки

КАКОЙ PYTON?????? PYTHON!!!!!!!!!!!!!!!!!!!!]


Комментировать


Похожие вопросы


  • Показать ещё
    Загружается…

07 февр. 2023, в 10:17

2000 руб./за проект

07 февр. 2023, в 10:08

250000 руб./за проект

07 февр. 2023, в 09:26

4000 руб./за проект

Минуточку внимания

Я установил последнюю версию Python для Win10 из Релизы для Windows. Просто набрав py в Command Prompt Window запускает питон.

Microsoft Windows [Version 10.0.15048]
(c) 2017 Microsoft Corporation. All rights reserved.

C:Userssg7>py
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>`enter code here`

Тестирование:

>>> print("hello!")
hello!
>>>

Имейте в виду, что в моем случае Python был установлен в C:Userssg7AppDataLocalProgramsPythonPython36> каталог

C:Userssg7AppDataLocalProgramsPythonPython36>dir
 Volume in drive C is Windows7_OS
 Volume Serial Number is 1226-12D1

 Directory of C:Userssg7AppDataLocalProgramsPythonPython36

08/05/2018  07:38 AM    <DIR>          .
08/05/2018  07:38 AM    <DIR>          ..
12/18/2017  09:12 AM    <DIR>          DLLs
12/18/2017  09:12 AM    <DIR>          Doc
12/18/2017  09:12 AM    <DIR>          include
12/18/2017  09:12 AM    <DIR>          Lib
12/18/2017  09:12 AM    <DIR>          libs
10/03/2017  07:17 PM            30,334 LICENSE.txt
10/03/2017  07:17 PM           362,094 NEWS.txt
10/03/2017  07:15 PM           100,504 python.exe
10/03/2017  07:12 PM            58,520 python3.dll
10/03/2017  07:12 PM         3,610,776 python36.dll
10/03/2017  07:15 PM            98,968 pythonw.exe
08/05/2018  07:38 AM           196,096 Removescons.exe
08/05/2018  07:38 AM            26,563 scons-wininst.log
08/05/2018  07:38 AM    <DIR>          Scripts
12/18/2017  09:12 AM    <DIR>          tcl
12/18/2017  09:12 AM    <DIR>          Tools
06/09/2016  11:53 PM            87,888 vcruntime140.dll
               9 File(s)      4,571,743 bytes
              10 Dir(s)  20,228,898,816 bytes free

Когда я нахожусь в C:Userssg7> уровень каталога python можно вызвать, набрав
AppDataLocalProgramsPythonPython36python

C:Userssamg>AppDataLocalProgramsPythonPython36python
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Более новый Python 3.7 будет установлен по адресу:
C:UsersYourUserNameHereAppDataLocalProgramsPythonPython37

Если вы хотите, вы можете добавить к переменной окружения вашего пути:
%USERPROFILE%AppDataLocalProgramsPythonPython36

14 ответов

Наконец-то это сработало!!!

Мне нужно было что-то сделать, чтобы заставить его работать

  • Добавить C:Python27в конец системной переменной PATH
  • Добавить C:Python27в конец системной переменной PYTHONPATH

Мне пришлось добавить их как для работы, так и для работы.

Если я добавил какие-либо подкаталоги, по какой-то причине это не сработало.

Спасибо всем за ваши ответы.

Rohit Rayudu
28 нояб. 2012, в 02:54

Поделиться

Видео было очень полезно.

  • Перейдите к свойствам системы → Предварительно (или введите «system env» в
    меню «Пуск».)
  • Выберите переменные окружения
  • Отредактируйте переменную «PATH»
  • Добавьте 2 новых пути: C:Python27 ‘и’ C:Python27scripts ‘
  • Запустите cmd снова и введите python.

это сработало для меня

Kazim Homayee
04 авг. 2016, в 13:51

Поделиться

Kalle опубликовал ссылку на страницу с этим видео, но это было сделано на XP. Если вы используете Windows 7:

  • Нажмите клавишу Windows.
  • Введите «system env». Нажмите enter.
  • Нажмите alt + n
  • Нажмите alt + e
  • Нажмите правую кнопку, а затем ; (точку с запятой)
  • Не добавляя пробел, введите это в конце: C:Python27
  • Нажмите дважды. Хит esc.
  • Используйте windows key + r для вызова диалогового окна запуска. Введите python и нажмите enter.

Droogans
28 нояб. 2012, в 03:58

Поделиться

Я, наверное, самый начинающий пользователь здесь, я провел шесть часов, чтобы запустить python в командной строке в Windows 8. Как только я установил 64-разрядную версию, я удалил ее и заменил ее 32-разрядной версией, Затем я попробовал большинство предложений здесь, особенно, указав путь в системных переменных, но все же это не сработало.

Тогда я понял, когда я ввел в командной строке:
echo% path%

Путь по-прежнему не был направлен на C:python27. Поэтому я просто перезапустил компьютер, и теперь он работает.

Ocean Flyer
02 апр. 2015, в 00:20

Поделиться

Я установил последний Python для Win10 из Релизы для Windows.
Просто введите py в Command Prompt Window, запустив Python.

Microsoft Windows [Version 10.0.15048]
(c) 2017 Microsoft Corporation. All rights reserved.

C:Userssg7>py
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>`enter code here`

Тестирование:

>>> print("hello!")
hello!
>>>

sg7
18 дек. 2017, в 15:22

Поделиться

Просто зайдите с командой py. Я запускаю python 3.6.2 на Windows 7, и он работает нормально.

Я удалил все пути python из системного каталога, и пути не отображаются, когда я запускаю команду echo %path% в cmd. Python все еще работает нормально.

Я столкнулся с этим, случайно нажав enter, набрав python

EDIT: я не упоминал, что я установил python в пользовательскую папку C:Python

user8540415
30 авг. 2017, в 23:06

Поделиться

Когда вы добавляете каталог python в путь (Computer > Properties > Advanced System Settings > Advanced > Environmental Variables > System Variables > Path > Edit), не забудьте добавить точку с запятой, а затем убедитесь, что вы добавляете точный каталог где хранится файл «python.exe» (например, C:PythonPython27, если это то, где хранится «python.exe» ). Затем перезапустите командную строку.

cameronroytaylor
21 янв. 2016, в 22:16

Поделиться

Они дали нам script сделать это для нас уже

C:UsershUTBERAppDataLocalProgramsPythontoolsscriptswin_add2path.py

Вам нужно убедиться, что вы закрываете и открываете cmd, иначе он не будет иметь новый путь.

Если вы не можете найти этот script, это пути, которые он добавит, и мне пришлось добавить вручную в конце.

C:UsershUTBERAppDataLocalProgramsPythonPython35
C:UsershUTBERAppDataLocalProgramsPythonPython35Scripts

Были мои и теперь python работает в cmd

Jamie Hutber
24 нояб. 2015, в 15:52

Поделиться

Всего несколько комментариев:

  • Не устанавливайте PYTHONPATH, если вы хотите получить Python на PATH. Переменная среды PYTHONPATH сообщает Python, где искать модули для импорта. Установка его на C:Python27 не принесет ничего полезного, хотя это, вероятно, безвредно.

  • Изменение переменных среды (включая PATH) из «Редактировать системные переменные» не влияет на уже запущенные процессы. Это означает, что вам нужно перезапустить cmd.exe для изменений в работе. Однако перезагрузка не требуется.

  • При изменении PATH также добавьте подкаталог Scripts. Или, говоря другими словами (и используя предыдущий пример): add ;C:Python27;C:Python27Scripts. Это позволит вам запускать скрипты типа easy_install, pip, virtualenv или sphinx из командной строки — после установки тех, что есть. Это примерно как UNIX-y, поскольку он подходит для Windows. (N.B. Подкаталог Scripts отсутствует после чистой установки Python, но будет создан при необходимости.)

  • Не помещайте дополнительные Lib или DLL в каталог PATH. Там нет необходимости, и это может нанести вред.

  • Если вы установили несколько версий Python (что не так уж редко), вам может быть лучше не помещать их в PATH, а вместо этого создавать разные ярлыки для cmd.exe для разных версии, которые устанавливают PATH для каждой версии. Вы также можете быть заинтересованы в PEP-397.

grainednoise
28 нояб. 2012, в 19:51

Поделиться

Вы должны добавить исполняемый файл python в свой SYSTEM PATH, выполните следующие действия: My Computer > Properties > Advanced System Settings > Environment Variables > Затем под системными переменными я создаю новую переменную под названием «PythonPath». В этой переменной у меня есть "C:Python27Lib;C:Python27DLLs;C:Python27Liblib-tk;C:other-foolder-on-the-path".

Изображение 131285

enginefree
28 нояб. 2012, в 03:52

Поделиться

Вам нужно добавить python к вашему PATH. Я мог ошибаться, но Windows 7 должна иметь тот же самый cmd, что и Windows 8. Попробуйте это в командной строке. Используя setx постоянно, вы вносите изменения в PATH. Обратите внимание, что нет равных знаков, и используются кавычки.

setx PATH "%PYTHONPATH%;C:python27"

Установите c:python27 в каталог версии python, который вы хотите запустить из ввода python в командной строке.

Aesthete
28 нояб. 2012, в 03:16

Поделиться

Если вы работаете с командной строкой, и если вы столкнулись с проблемой даже после добавления пути python к системной переменной PATH.

Не забудьте перезапустить командную строку (cmde.exe).

Jerin
26 сен. 2017, в 20:31

Поделиться

Похоже, что исполняемый файл python не найден в вашем PATH, который определяет, где он ищет исполняемые файлы. См. официальные инструкции для получения инструкций о том, как получить исполняемые файлы python в вашем PATH.

Carl Ekerot
28 нояб. 2012, в 03:35

Поделиться

Добавьте каталог python bin в переменную PATH вашего компьютера. Его перечислены в разделе Переменные среды в свойствах компьютеров → Дополнительные настройки в Windows 7. Это должно быть то же самое для Windows 8.

asheeshr
28 нояб. 2012, в 02:26

Поделиться

Ещё вопросы

  • 0PHP, вторичный ключ MYSQL
  • 0Получение информации с сайта с помощью Jsoup
  • 1Разделить / разделить дома, экран на 4 части? Xamarin iOS
  • 1Нет текущего контекста openGL при возвращении из деятельности?
  • 0Объект опции по умолчанию ng-options не выделяется массивом объектов
  • 1Pandas создает новый столбец каждый раз, когда я сохраняю фрейм данных как csv в Python
  • 0Удалить data-icon динамически
  • 1Реагируй Родной. Двоичная строка MP3 (Uint8Array (9549)) для потоковой передачи или файла
  • 0Сброс соединения по пиру через 8 минут
  • 0динамические селекторы добавляются при выполнении функции
  • 0CodeIgniter 3 — неагрегированная группа столбцов по
  • 0дата форматирования от контроллера не получает ожидаемый результат
  • 0CSS изменить размер содержимого таблицы до ширины печати
  • 0Путаница в заголовке файла cpp
  • 0Перезаписать текущую тему в YII
  • 0Нажмите кнопку и отобразите соответствующий файл php в теле той же страницы.
  • 1JVM Tunning класса Java
  • 1python для эффективного использования результата функции в операторе if
  • 1получить исключение при вставке событий в календарь Android
  • 1Пропустить цикл для списка Нет
  • 1Есть ли способ перехватить отмененные запросы, используя хар-прокси?
  • 0Allegro al_load_ttf_font не может найти файл
  • 1Возьмите значение всех ненулевых текстовых полей в форме и поместите его в массив. C # Winforms
  • 0MySQL сервер ушел на ОБНОВЛЕНИЕ (Огромный QUERY, около 85 МБ), используя mysli PHP
  • 0Как оптимизировать запрос SELECT INTO OUTFILE с помощью LEFT JOIN в MySQL
  • 1Создавайте приложения для Android в Eclipse, используя общую библиотеку
  • 1POST-запрос в fiddler: отправка пользовательского объекта, в качестве члена которого используется другой объект
  • 0Загрузка файлов не работает с помощью jQuery File Upload
  • 1Почему Integer.parseInt («53.6») не работает?
  • 1Функция сцепления не работает, когда внутри другой функции
  • 1Использование pandas dataframe для записи значений в новую ошибку csv-файла
  • 1Как мы можем скопировать данные столбца данных таблицы данных в другую таблицу данных?
  • 0Как должны быть подготовлены данные для параметризованных тестов?
  • 0Форматирование добавленного текста с использованием JavaScript
  • 1Странная вещь о выводе контента JSON в python
  • 1Захват ключа в андроид
  • 0Как gclid работает с Joomla
  • 0Половина полного предотвращения файлов PHP
  • 0Странная ошибка компоновщика
  • 0Нужны эти два <div> рядом
  • 0Среднее различие между 2 числами, расположенными в 2 разных таблицах
  • 1Метод клонирования Java
  • 0Сожмите и сохраните строку в поле VARCHAR в MySQL
  • 0SQL Получить значение из другой таблицы через идентификатор и отобразить общее
  • 1Включение и выключение потока в C #
  • 1Java — не работает привязка клавиш
  • 0Zend Framework 2: отображение активного состояния навигации для дочернего маршрута при использовании нескольких навигаций
  • 0Спрайт не работает (фон не корректируется, а ссылка не существует?)
  • 0Группировка пользователей по n группам размеров с помощью angularfire
  • 1switchMap не принимает функцию для выполнения внутри нее

Уведомления

  • Начало
  • » Python для новичков
  • » Не запускается python из cmd

#1 Фев. 26, 2013 21:35:09

Не запускается python из cmd

Здравствуйте. Установил python3.3 на Windows7-64bit. Прописал Path в системные переменные: Имя переменной “python”, значение переменной “C:Python33;C:Python33Libsite-packages;C:Python33Scripts;”. Все равно не запускается, пишет “”python“ не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.” Из директории в которой находится python запускается.
Что мне сделать чтобы он запускался и из других папок? Гугл не помог…

Офлайн

  • Пожаловаться

#2 Фев. 26, 2013 21:57:40

Не запускается python из cmd

Вообще-то переменная окружения и должна называться PATH. Она уже есть, нужно к ней дописать путь к папке, где лежит python.exe

Отредактировано cutwater (Фев. 26, 2013 21:58:40)

Офлайн

  • Пожаловаться

#3 Фев. 27, 2013 01:55:45

Не запускается python из cmd

там же установщик уже имеет опцию добавления в PATH

Stroy71
Все равно не запускается

надо перезайти в систему

Офлайн

  • Пожаловаться

#4 Фев. 27, 2013 09:22:19

Не запускается python из cmd

cutwater
Вообще-то переменная окружения и должна называться PATH. Она уже есть, нужно к ней дописать путь к папке, где лежит python.exe

Спасибо большое! Все получилось.

Офлайн

  • Пожаловаться

#5 Фев. 27, 2013 14:28:13

Не запускается python из cmd

py.user.next
надо перезайти в систему

Ну зачем так радикально. Могло быть достаточно заново открыть консоль.

Офлайн

  • Пожаловаться

#6 Фев. 27, 2013 21:51:33

Не запускается python из cmd

Может это какой-то неизвестный баг, но на одном западном форуме я видел сообщение о проблеме, подобной моей. К сожалению там ее решить не смогли. Всё дело в том, что я неправильно прописал переменную окружения. Вернее, не нужно было создавать новую, а воспользоваться уже имеющей переменной PATH.
Кстати в Windows XP подобной проблемы не возникло. И прописывать ничего не пришлось.

Отредактировано Stroy71 (Фев. 28, 2013 10:35:28)

Офлайн

  • Пожаловаться

#7 Фев. 27, 2013 22:58:17

Не запускается python из cmd

Если прописать в %PATH%, изменения будут доступны только в текущей консоли. Чтобы оно было доступно везде, надо нажать Win+Break -> Дополнительно -> Переменные окружения, дописать свой путь в PATH, ок и открыть новую консоль.

Офлайн

  • Пожаловаться

#8 Фев. 28, 2013 01:06:25

Не запускается python из cmd

krishnarama
Ну зачем так радикально. Могло быть достаточно заново открыть консоль.

этого может не хватить, чтобы все консоли открывались с новым PATH (возможно, они наследуются от основной консоли, которая загружается при входе)

Офлайн

  • Пожаловаться

#9 Фев. 28, 2013 13:04:36

Не запускается python из cmd

py.user.next
основной консоли, которая загружается при входе)

Мы про windows? И все это легко проверяется экспериментом, зачем гадать.

Офлайн

  • Пожаловаться

#10 Март 1, 2013 01:46:58

Не запускается python из cmd

krishnarama
И все это легко проверяется экспериментом

да, согласен
раньше нужно было перезайти, но тогда я через реестр менял переменные среды, потому что не знал про специальное место в системе, где можно устанавливать их (на XP дело было)

Офлайн

  • Пожаловаться

  • Начало
  • » Python для новичков
  • » Не запускается python из cmd

Понравилась статья? Поделить с друзьями:
  • Команда powershell windows 10 для исправления ошибок
  • Кодировщик utf 8 в windows 1251
  • Команда powercfg h off windows 10
  • Кодировщик mpeg2 для windows 7 скачать бесплатно
  • Команда postgres psql не распознается в среде windows