I downloaded and installed Python 3.5 from https://www.python.org/downloads/ on my Windows 10 machine with IDLE
I want to install other packages using pip using the following and various other options in the IDLE commandline editor.
>> pip install packagename
>> pip --install packagename
>> pip --upgrade packagename
>> pip upgrade packagename
Where packagename I have tried various packages available from my installed Python modules Tried all the above options without any packagename a well.
In short, pip doesn’t work and I am stuck.
I get Syntaxerror: invalid syntax
pip is preinstalled in my Python. confirmed this with the command «import pip» and from help(‘modules’).
Need help on how to proceed.
System specs: Windows 10, with login as User (Local Admin privileges). this is the only User on my computer.
asked Oct 3, 2016 at 12:55
instead of typing in «python». try using «py».
for ex:
py -m pip install packagename
py -m pip --install packagename
py -m pip --upgrade packagename
py -m pip upgrade packagename
note: this should be done in the command prompt «cmd» and not in python idle. also FYI pip is installed with python 3.6 automatically.
Dmitry
6,77614 gold badges37 silver badges40 bronze badges
answered Oct 15, 2017 at 16:20
BJJ VeganBJJ Vegan
5914 silver badges3 bronze badges
1
Make sure the path to scripts folder for the python version is added to the path environment/system variable in order to use pip command directly without the whole path to pip.exe which is inside the scripts folder.
The scripts folder would be inside the python folder for the version that you are using, which by default would be inside c drive or in c:/program files or c:/program files (x86).
Then use commands as mentioned below. You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator
.
python -m pip install packagename
python -m pip uninstall packagename
python -m pip install --upgrade packagename
In case you have more than one version of python. You may replace python
with py -versionnumber
for example py -2
for python 2 or you may replace it with the path to the corresponding python.exe file. For example "c:\python27\python"
.
answered Mar 30, 2018 at 17:57
1
It’s a really weird issue and I am posting this after wasting my 2 hours.
You installed Python and added it to PATH. You’ve checked it too(like 64-bit etc). Everything should work but it is not.
what you didn’t do is a
terminal/cmd restart
restart your terminal and everything would work like a charm.
I Hope, it helped/might help others.
answered Oct 26, 2019 at 21:32
I faced a problem upgrading pip from version 9.0.1 to 9.0.3
The upgrade failed middle way(after uninstalling version 9.0.1 and without installing version 9.0.3).
This usually creates a broken pip file.
Broken pip can be solved by the command—>
easy_install pip
Which usually installs the latest version of pip, and solves the issue.
In order to confirm, type
pip --version
Hope this was helpfull…
answered Mar 25, 2018 at 15:09
J11J11
4554 silver badges8 bronze badges
According to pip documentation
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org
But I was surprised when I typed pip --version
in the Python Launcher and it gave me an error saying that ‘pip’ is not recognized. Then I tried the same in Python IDLE which gave the same error. Then I opened a cmd and typed python pip --version
and it said something like «can’t open file».
Solution:
I finally realized that pip
commands are properly recognized outside of the python.exe, because pip is a separate executable. So, just open a cmd and type pip --version
and it should work as expected. If you call pip
inside a Python executable (such as the Launcher, IDLE, or calling python pip
), it assumes pip is just a variable and complains that it is not defined.
Note: I made sure that C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\
and C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\Scripts\
are included in the PATH
variable.
answered May 14, 2021 at 11:01
deedee
1291 silver badge3 bronze badges
1
open command prompt
python pip install <package-name>
This should complete the process
answered Jan 20, 2017 at 13:43
Pavan NathPavan Nath
1,4941 gold badge14 silver badges23 bronze badges
1
You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator.
It’s worked for me.
answered Mar 31, 2018 at 11:06
Igor OsipovIgor Osipov
1571 silver badge12 bronze badges
I had the same problem on Visual Studio Code. For various reasons several python versions are installed on my computer. I was thus able to easily solve the problem by switching python interpreter.
If like me you have several versions of python on you machine, in Visual Studio Code, you can easily change the interpreter by clicking on the bottom left corner where it says Python…
answered Sep 29, 2020 at 10:08
This command fixed my problem:
pip install --user mpr
answered Apr 24 at 15:03
Tohid MakariTohid Makari
1,7703 gold badges16 silver badges30 bronze badges
I downloaded and installed Python 3.5 from https://www.python.org/downloads/ on my Windows 10 machine with IDLE
I want to install other packages using pip using the following and various other options in the IDLE commandline editor.
>> pip install packagename
>> pip --install packagename
>> pip --upgrade packagename
>> pip upgrade packagename
Where packagename I have tried various packages available from my installed Python modules Tried all the above options without any packagename a well.
In short, pip doesn’t work and I am stuck.
I get Syntaxerror: invalid syntax
pip is preinstalled in my Python. confirmed this with the command «import pip» and from help(‘modules’).
Need help on how to proceed.
System specs: Windows 10, with login as User (Local Admin privileges). this is the only User on my computer.
asked Oct 3, 2016 at 12:55
instead of typing in «python». try using «py».
for ex:
py -m pip install packagename
py -m pip --install packagename
py -m pip --upgrade packagename
py -m pip upgrade packagename
note: this should be done in the command prompt «cmd» and not in python idle. also FYI pip is installed with python 3.6 automatically.
Dmitry
6,77614 gold badges37 silver badges40 bronze badges
answered Oct 15, 2017 at 16:20
BJJ VeganBJJ Vegan
5914 silver badges3 bronze badges
1
Make sure the path to scripts folder for the python version is added to the path environment/system variable in order to use pip command directly without the whole path to pip.exe which is inside the scripts folder.
The scripts folder would be inside the python folder for the version that you are using, which by default would be inside c drive or in c:/program files or c:/program files (x86).
Then use commands as mentioned below. You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator
.
python -m pip install packagename
python -m pip uninstall packagename
python -m pip install --upgrade packagename
In case you have more than one version of python. You may replace python
with py -versionnumber
for example py -2
for python 2 or you may replace it with the path to the corresponding python.exe file. For example "c:\python27\python"
.
answered Mar 30, 2018 at 17:57
1
It’s a really weird issue and I am posting this after wasting my 2 hours.
You installed Python and added it to PATH. You’ve checked it too(like 64-bit etc). Everything should work but it is not.
what you didn’t do is a
terminal/cmd restart
restart your terminal and everything would work like a charm.
I Hope, it helped/might help others.
answered Oct 26, 2019 at 21:32
I faced a problem upgrading pip from version 9.0.1 to 9.0.3
The upgrade failed middle way(after uninstalling version 9.0.1 and without installing version 9.0.3).
This usually creates a broken pip file.
Broken pip can be solved by the command—>
easy_install pip
Which usually installs the latest version of pip, and solves the issue.
In order to confirm, type
pip --version
Hope this was helpfull…
answered Mar 25, 2018 at 15:09
J11J11
4554 silver badges8 bronze badges
According to pip documentation
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org
But I was surprised when I typed pip --version
in the Python Launcher and it gave me an error saying that ‘pip’ is not recognized. Then I tried the same in Python IDLE which gave the same error. Then I opened a cmd and typed python pip --version
and it said something like «can’t open file».
Solution:
I finally realized that pip
commands are properly recognized outside of the python.exe, because pip is a separate executable. So, just open a cmd and type pip --version
and it should work as expected. If you call pip
inside a Python executable (such as the Launcher, IDLE, or calling python pip
), it assumes pip is just a variable and complains that it is not defined.
Note: I made sure that C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\
and C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\Scripts\
are included in the PATH
variable.
answered May 14, 2021 at 11:01
deedee
1291 silver badge3 bronze badges
1
open command prompt
python pip install <package-name>
This should complete the process
answered Jan 20, 2017 at 13:43
Pavan NathPavan Nath
1,4941 gold badge14 silver badges23 bronze badges
1
You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator.
It’s worked for me.
answered Mar 31, 2018 at 11:06
Igor OsipovIgor Osipov
1571 silver badge12 bronze badges
I had the same problem on Visual Studio Code. For various reasons several python versions are installed on my computer. I was thus able to easily solve the problem by switching python interpreter.
If like me you have several versions of python on you machine, in Visual Studio Code, you can easily change the interpreter by clicking on the bottom left corner where it says Python…
answered Sep 29, 2020 at 10:08
This command fixed my problem:
pip install --user mpr
answered Apr 24 at 15:03
Tohid MakariTohid Makari
1,7703 gold badges16 silver badges30 bronze badges
@Nolrox
Python-разработчик
Качаю Python, захожу в консоль, пишу pip install и выдает что «pip» не является внутренней или внешней командой, исполняемой программой или пакетным файлом. Что делать?
-
Вопрос задан
-
58577 просмотров
Добавить в PATH.
Гугли переменные среды
Или даже будет быстрее переустановить питон и при установке поставить соответствующую галочку.
Если винда, то тут 99% что при установке не поставил галочку добавить пути в PATH.
1. Руками прописать
2. Удалить и поставить заново, не пропустив галочку
Скорее всего, у вас просто не была установлена галочка на работу пипа со всех директорий, или переустановите пайтон, почтавив эту галочку, илм пробуйте выполнять эту команду с директории где находится пайтон
Пригласить эксперта
Нужно обновить pip:
python -m pip install --upgrade pip
Скорее всего вы используете Python 3.9. Но многие мейнтейнеры не успели обновить пакеты. Поэтому установите Python 3.8
Discord.py поддерживается пока питоном 3.5 … 3.8!
И неплохо бы установить Microsoft C++ Build Tools, пригодится для установки некоторых пакетов.
если галочка PATH python не сработала можно: настроить ручную.
здесь объясняют как в ручную настроить PATH для python (для pip достаточно просто указать в PATH адрес к scripts в каталоге python)
-
Показать ещё
Загружается…
10 окт. 2023, в 10:42
200000 руб./за проект
10 окт. 2023, в 10:36
500 руб./за проект
10 окт. 2023, в 10:27
15000 руб./за проект
Минуточку внимания
Package Installer for Python (PIP) is the preferred package-management system for Python. It’s used to install third-party packages from an online repository called the Python Package Index.
When attempting to install Python packages, you may encounter errors stating PIP is not recognized, command not found, or can’t open the file. In this article, we’ve detailed why such errors occur, as well as how you can fix them.
Table of Contents
Why is the PIP Install Not Working?
The most common reasons for issues with PIP installations is either that an incorrect PIP path is added to the PATH system variable, or the PIP path isn’t added at all. This often happens because users forget or don’t know to include PIP during the Python installation. In case of Linux, PIP isn’t included during the Python installation to start with, so you have to install it separately later.
In most cases, you won’t encounter this error if you use a Python IDE instead of CMD. However, if you don’t want to use an IDE, or you face this error despite using an IDE, you can try the fixes from the section below to resolve the issue.
Include PIP During Installation
First, you should make sure that PIP was actually included during the Python installation. Here are the steps to do so:
- Press Win + R, type
appwiz.cpl
, and press Enter. - Select Python from the list and press Change.
- Click on Modify. Ensure pip is selected and press Next > Install.
- After the installation completes, check if you can install the Python packages now.
Add PIP to PATH Variable
As stated, the PIP Install path needs to be added to the PATH system variable for it to work. Otherwise, CMD won’t recognize the command and you’ll encounter the not recognized error. First, you should check if this is the issue with the following steps:
- Press Win + R, type
cmd
, and press CTRL + Shift + Enter. - Type
echo %PATH%
and press Enter.
Depending on your Python version and install location, you may see a path like C:\Python36\Scripts
. This means the PIP path is already added to the PATH variable. If you don’t see it, you can add it via the command line with the following steps:
- Execute the following command:
setx PATH "%PATH%;<PIP Path>"
As stated, the PIP path will differ according to your Python version. We’ve usedC:\Python36\Scripts
as an example but in your case, the PIP path maybe different. If you aren’t sure what the PIP path is, check the GUI method below. - Start a new instance of command prompt and check if you can install any packages.
The command-line interface method returns a lot of paths at once, which can get confusing. Instead, you can also check the paths via the GUI. Here are the steps to do so:
- Press Win + R, type
sysdm.cpl
, and press Enter. - Switch to the Advanced tab and click on Environment Variables.
- In the System variables section, select Path and press Edit.
- Click on New and add the pip installation path. This differs depending on your Python version but for the current latest version (3.10), the path is:
C:\Users\Username\AppData\Local\Programs\Python\Python310\Scripts
.
- Check if you can install a pip package now.
Use Correct PIP and Python Version
The pip install packagename
command is generally used to install Python packages. If this command doesn’t work, you can try the commands shown below instead. Don’t forget to replace packagename with the actual package you’re trying to install.
python -m pip install packagename
py -m pip install packagename
If you have multiple python versions, specify the version number as shown below:
py -3 -m pip install packagename
Manually Install PIP
Due to failed upgrades and similar issues, your PIP file can get corrupted which can also lead to various problems such as PIP Install Not Working. One easy way to fix this is by removing Python and reinstalling it. You can find the steps to do so in the next section.
Alternatively, you can also manually install PIP with the following steps:
- Download get-pip.py and store it in Python’s installation directory.
- Enter
cd <above directory>
to switch to the installation directory in CMD. - Type
py get-pip.py
and press Enter. - Once pip is installed, check if you can install any packages.
In case of Linux, pip doesn’t come bundled with Python. You have to manually install it first. You can do so by executing the following command in the terminal:
sudo apt-get -y install python3-pip
Reinstall Python
The final option is to remove Python entirely and then reinstall it. Any problematic files will be replaced during the process, which should ultimately resolve the issue. Here are the steps to do so:
- Press Win + R, type appwiz.cpl, and press Enter.
- Select Python from the list, click on Uninstall and follow the on-screen instructions.
- Restart your PC and reinstall Python.
- Enable the Add Python to Path option and select Customize installation. Also, make sure that PIP is included during the installation.
- After the installation completes, restart your PC once more, then check if you can install any Python packages.
Сегодня поговорим об установке Python и о первых проблемах с которыми могут столкнуться начинающие программисты. После установки Python все советую проверит правильность его установки введя в командной строке Python, после этого вы должны увидеть установленную версию питона. Так же вы сможете вводим простенькие команды и выполнять их через командную строку например, введя print(«привет»), код должен выполниться и отобразить просто «Привет».
Для установки различных модулей используется PIP, например, для установки requests в командной строке нужно ввести pip install requests. Вообще большинство пользователей после установки питона и введя в командной строке «PIP» или «Python» получает сообщение об ошибке «не является внутренней или внешней командой, исполняемой программой или пакетным файлом».
Решение данный проблемы очень простое, в интернете очень много ответов, но все они очень краткие, сжатые, без скриншотов. Разобраться новичку будет достаточно сложно. Большинство ответов имеют вот такой вид
«Вам нужно установить путь к pip в переменные окружения»
Думаю новичку это абсолютно ни о чем не говорит, он еще больше запутается. Поэтому я решил подробно описать решение данной проблемы.
Простое решение проблемы в Windows 10
И так при вводе в командной строке PIP вы видите сообщение.
«PIP» не является внутренней или внешней командой, исполняемой программой или пакетным файлом
Тоже самое и с Python
«Python» не является внутренней или внешней командой, исполняемой программой или пакетным файлом
Вам нужно добавить значения в переменную Path, рассказывать что это не буду, просто открываем свойства компьютера и выбираем «Дополнительные параметры системы».
Далее в свойствах системы переходим во вкладку «Дополнительно» и снижу нажимаем «Переменные среды».
В открывшемся окне в верхней части отмечаем переменную «Path» и нажимаем изменить.
В поле «Значение переменной» дописываем путь до папки в которой у вас установлен Питон, в моем случае это С:\Python, так же нужно указать путь до папки где лежит файл pip.exe у меня это С:\Python\Scripts. Дописываем через ; вот так.
С:\Python\Scripts;С:\Python;
Сохраняем.
Рекомендую изменять стандартный путь установки Питона на С:\Python.
Теперь проверяем результат запускаем командную строку и пишем сначала «PIP».
Потом пробуем написать «Python», после шеврона (>>>) можно уже написать какой нибудь код например, print(«Привет!»).
Если выше описанное для вас сложно, то можно переустановить сам Питон, отметив в главном окне пункт «Add Python 3.9 to PATH».
В процессе установки все пути будут прописаны автоматически. Вот так можно избавиться от ошибки «не является внутренней или внешней командой, исполняемой программой или пакетным файлом», которая появляется в командной строке при вводе «PIP» или «Python».