This is the full text of the blog post linked below:
If you’ve tried installing a package with pip recently, you may have encountered this error:
Could not fetch URL https://pypi.python.org/simple/Django/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Cannot fetch index base URL https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/Django/1.5.1: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/1.5.1 when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not fetch URL https://pypi.python.org/simple/Django/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not find any downloads that satisfy the requirement Django==1.5.1 (from -r requirements.txt (line 1))
No distributions at all found for Django==1.5.1 (from -r requirements.txt (line 1))
Storing complete log in /Users/paul/.pip/pip.log
This seems to be an issue with an old version of OpenSSL being incompatible with pip 1.3.1. If you’re using a non-stock Python distribution (notably EPD 7.3), you’re very likely to have a setup that isn’t going to work with pip 1.3.1 without a shitload of work.
The easy workaround for now, is to install pip 1.2.1, which does not require SSL:
curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
python setup.py install
If you are using EPD, and you’re not using it for a class where things might break, you may want to consider installing the new incarnation: Enthought Canopy. I know they were aware of the issues caused by the previous version of OpenSSL, and would imagine they are using a new version now that should play nicely with pip 1.3.1.
This is the full text of the blog post linked below:
If you’ve tried installing a package with pip recently, you may have encountered this error:
Could not fetch URL https://pypi.python.org/simple/Django/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Cannot fetch index base URL https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/Django/1.5.1: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/1.5.1 when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not fetch URL https://pypi.python.org/simple/Django/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL https://pypi.python.org/simple/Django/ when looking for download links for Django==1.5.1 (from -r requirements.txt (line 1))
Could not find any downloads that satisfy the requirement Django==1.5.1 (from -r requirements.txt (line 1))
No distributions at all found for Django==1.5.1 (from -r requirements.txt (line 1))
Storing complete log in /Users/paul/.pip/pip.log
This seems to be an issue with an old version of OpenSSL being incompatible with pip 1.3.1. If you’re using a non-stock Python distribution (notably EPD 7.3), you’re very likely to have a setup that isn’t going to work with pip 1.3.1 without a shitload of work.
The easy workaround for now, is to install pip 1.2.1, which does not require SSL:
curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
python setup.py install
If you are using EPD, and you’re not using it for a class where things might break, you may want to consider installing the new incarnation: Enthought Canopy. I know they were aware of the issues caused by the previous version of OpenSSL, and would imagine they are using a new version now that should play nicely with pip 1.3.1.
@Nolrox
Python-разработчик
Качаю Python, захожу в консоль, пишу pip install и выдает что «pip» не является внутренней или внешней командой, исполняемой программой или пакетным файлом. Что делать?
-
Вопрос задан
-
57468 просмотров
Добавить в 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)
-
Показать ещё
Загружается…
21 сент. 2023, в 19:28
10000 руб./за проект
21 сент. 2023, в 19:06
11111 руб./за проект
21 сент. 2023, в 19:00
6000000 руб./за проект
Минуточку внимания
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.
Ошибки SSL являются одной из самых распроcтраненных проблем, с которыми сталкиваются разработчики при работе с Python. Особенно часто они возникают при
Ошибки SSL являются одной из самых распроcтраненных проблем, с которыми сталкиваются разработчики при работе с Python. Особенно часто они возникают при попытке установить новые пакеты с помощью инструмента pip.
Ошибку можно встретить при выполнении команды pip install
, например:
pip install requests
В результате вы получите сообщение об ошибке, которое выглядит примерно так:
Could not fetch URL https://pypi.python.org/simple/requests/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
Это означает, что pip не может установить защищенное соединение с сервером PyPi, который хранит все пакеты Python.
Существует несколько способов решения данной проблемы.
Использование параметра —trusted-host
Один из самых простых способов – добавить параметр --trusted-host
, указав в качестве значения домен, с которым pip не может установить защищенное соединение. Например:
pip install --trusted-host pypi.python.org requests
Таким образом, вы говорите pip, что домен pypi.python.org
является надежным, и pip должен игнорировать ошибки SSL при соединении с этим доменом.
Обновление pip
Если вы используете старую версию pip, то возможно, она не поддерживает некоторые более новые функции SSL. В этом случае обновление pip может помочь решить проблему. Обновить pip можно следующей командой:
pip install --upgrade pip
Использование параметра -i
Еще один способ – использовать параметр -i
для указания зеркала PyPi, которое не использует SSL. Например:
pip install -i http://pypi.python.org/simple/ requests
Но стоит помнить, что такой способ может повлечь за собой риски безопасности, так как соединение будет не защищено.
Использование сертификата SSL
Если у вас есть собственный сертификат SSL, вы можете указать его при помощи параметра --cert
. Например:
pip install --cert /path/to/your/certificate.pem requests
В общем, ошибки SSL могут быть вызваны различными причинами, и иногда может потребоваться немного экспериментировать, чтобы найти подходящее решение. Но в большинстве случаев один из перечисленных выше способов должен помочь.