Non zero exit code 2 pycharm ошибка

To not make project in the venv/Scripts/ directory, add path while executing django-admin startproject [project-name-that-you-want] [project-directory-path] this command.
This will let you have your django project in the directory you want, so that your project directory looks like the ones that you can find in tutorial videos.

answered May 2, 2022 at 2:12

Brad Lee's user avatar

As you can see, PyCharm has given you a «proposed solution», so use that.

Basically, PyCharm is trying to add, or you have tried to add, a --build-dir argument to the pip command but pip doesn’t know what --build-dir means.

Open your Terminal/Command Prompt, cd into your project directory and run pip install django.

answered Apr 26, 2022 at 5:17

WhatTheClown's user avatar

WhatTheClownWhatTheClown

4641 gold badge7 silver badges24 bronze badges

Open Pycharm settings and go to Interpreter settings File->Settings->Project->Project Interpreter and click the + button on right side, then find django and
install it.

answered Apr 26, 2022 at 5:24

Ali Aref's user avatar

Ali ArefAli Aref

1,72311 silver badges27 bronze badges

preface

When using pycharm to install a third-party package in the python virtual environment in Python interpreter settings, it is likely to report an error: non zero exit code (2), as shown in the figure:

even upgrading pip will report an error, as shown in the figure:

Tips are as follows:

Try to run this command from the system terminal. 
Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 
'D:Program FilesPythonpy36-basic-vScriptspython.exe'.

As above belongs, the official says the possible reason is that pip is not installed in the specified directory of the virtual environment, and suggests running the pip command in the terminal to install the third-party package.

The official hint has a certain degree of reasonableness, but it does not try all cases, you can check whether the pip module exists in the directory of the virtual environment, if it does not exist, the pip module can be installed in the specified directory; if it exists, it is not the problem of the pip module path, so what exactly is the reason?

After investigation, it is the problem of pip version, my Python version is 3.6, pip version is 21.3.1, this version of pip will definitely appear the problem, the solution is also very simple, the pip version can be downgraded to 20.2.4, operation method see the following program 2: Downgrade pip version. (It is not recommended to upgrade pip, because new versions of pip may have the same problem)

Solution 1 (recommended): install the third-party package using the terminal terminal

Click Terminal at the bottom of pycharm toolbar , as shown in the following figure:

enter the PIP install command to install the third-party package, as shown in the figure:

But this solution treats the symptom but not the root cause, the problem is not solved, only the installation of third-party packages by alternative methods, if you want to solve the problem at all, please see solution 2 below.

Solution 2 (fundamental solution): downgrade the PIP version

First, open a project using pycharm. If there is no Python environment, you need to create a virtual environment first, as shown in the following figure:

In file - Settings - Python interpreter, we can see that the version of PIP in Python virtual environment is 21.3.1. As shown in the figure below, we need to downgrade the version of Pip to 20.2.4

Click Terminal on the toolbar at the bottom of pychart, as shown in the following figure:

enter the following command. Note that there must be Python -m, otherwise there is no permission:

python -m pip install pip==20.2.4

After entering the command, the following prompt appears to prove that the downgrade is successful:

enter the command PIP - V to view the current PIP version, as shown in the following figure:

the problem has been successfully solved so far. The third-party package can be successfully installed in Settings, as shown in the following figure:

Read More:

Error during installation

Analyze problems

Pycharm relies on — build dir to install packages, but this has been removed in the latest version of PIP

The PIP I use now is version 21.3.1. The solution is to reduce the PIP version of the project to PIP 21.2.4

Specific operation

1. Run CMD or windows PowerShell as administrator

2. Enter the interpreter path under the file + – M PIP install PIP = = 21.2.4

3. Open pycharm and view PIP information in project interpreter

4. Now try downloading flash

5. You should be able to display success and create a py file

6. Run it and the following web address will appear. Click to open

7. When the content appears, flash is successfully installed

Similar Posts:

Когда я создаю новый проект django в pycharm, у меня возникает ошибка
введите описание изображения здесь

Помогите мне, пожалуйста

Как вы видите, PyCharm дал вам «предлагаемое решение», так что используйте его.

По сути, PyCharm пытается добавить, или вы пытались добавить, аргумент --build-dir к команде pip, но pip не знает, что означает --build-dir.

Откройте терминал/командную строку, cd войдите в каталог проекта и запустите pip install django.

Откройте настройки Pycharm и перейдите к настройкам переводчика File->Settings->Project->Project Interpreter и click кнопку + справа, затем найдите django и
установите его.

Чтобы не делать проект в каталоге venv/Scripts/, добавьте путь во время выполнения django-admin startproject [project-name-that-you-want] [project-directory-path] этой команды.
Это позволит вам разместить ваш проект django в нужной вам директории, так что ваша директория проекта будет похожа на те, которые вы можете найти в обучающих видео.

Вернуться на верх

preface

When using pycharm to install a third-party package in the python virtual environment in Python interpreter settings, it is likely to report an error: non zero exit code (2), as shown in the figure:

even upgrading pip will report an error, as shown in the figure:

Tips are as follows:

Try to run this command from the system terminal. 
Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 
'D:Program FilesPythonpy36-basic-vScriptspython.exe'.

As above belongs, the official says the possible reason is that pip is not installed in the specified directory of the virtual environment, and suggests running the pip command in the terminal to install the third-party package.

The official hint has a certain degree of reasonableness, but it does not try all cases, you can check whether the pip module exists in the directory of the virtual environment, if it does not exist, the pip module can be installed in the specified directory; if it exists, it is not the problem of the pip module path, so what exactly is the reason?

After investigation, it is the problem of pip version, my Python version is 3.6, pip version is 21.3.1, this version of pip will definitely appear the problem, the solution is also very simple, the pip version can be downgraded to 20.2.4, operation method see the following program 2: Downgrade pip version. (It is not recommended to upgrade pip, because new versions of pip may have the same problem)

Solution 1 (recommended): install the third-party package using the terminal terminal

Click Terminal at the bottom of pycharm toolbar , as shown in the following figure:

enter the PIP install command to install the third-party package, as shown in the figure:

But this solution treats the symptom but not the root cause, the problem is not solved, only the installation of third-party packages by alternative methods, if you want to solve the problem at all, please see solution 2 below.

Solution 2 (fundamental solution): downgrade the PIP version

First, open a project using pycharm. If there is no Python environment, you need to create a virtual environment first, as shown in the following figure:

In file - Settings - Python interpreter, we can see that the version of PIP in Python virtual environment is 21.3.1. As shown in the figure below, we need to downgrade the version of Pip to 20.2.4

Click Terminal on the toolbar at the bottom of pychart, as shown in the following figure:

enter the following command. Note that there must be Python -m, otherwise there is no permission:

python -m pip install pip==20.2.4

After entering the command, the following prompt appears to prove that the downgrade is successful:

enter the command PIP - V to view the current PIP version, as shown in the following figure:

the problem has been successfully solved so far. The third-party package can be successfully installed in Settings, as shown in the following figure:

Read More:

Error during installation

Analyze problems

Pycharm relies on — build dir to install packages, but this has been removed in the latest version of PIP

The PIP I use now is version 21.3.1. The solution is to reduce the PIP version of the project to PIP 21.2.4

Specific operation

1. Run CMD or windows PowerShell as administrator

2. Enter the interpreter path under the file + – M PIP install PIP = = 21.2.4

3. Open pycharm and view PIP information in project interpreter

4. Now try downloading flash

5. You should be able to display success and create a py file

6. Run it and the following web address will appear. Click to open

7. When the content appears, flash is successfully installed

Similar Posts:

Когда я создаю новый проект django в pycharm, у меня возникает ошибка
введите описание изображения здесь

Помогите мне, пожалуйста

Как вы видите, PyCharm дал вам «предлагаемое решение», так что используйте его.

По сути, PyCharm пытается добавить, или вы пытались добавить, аргумент --build-dir к команде pip, но pip не знает, что означает --build-dir.

Откройте терминал/командную строку, cd войдите в каталог проекта и запустите pip install django.

Откройте настройки Pycharm и перейдите к настройкам переводчика File->Settings->Project->Project Interpreter и click кнопку + справа, затем найдите django и
установите его.

Чтобы не делать проект в каталоге venv/Scripts/, добавьте путь во время выполнения django-admin startproject [project-name-that-you-want] [project-directory-path] этой команды.
Это позволит вам разместить ваш проект django в нужной вам директории, так что ваша директория проекта будет похожа на те, которые вы можете найти в обучающих видео.

Вернуться на верх

October 6, 2022October 6, 2022

I encountered «Non-zero exit code (2)» error when I want to install package in PyCharm!
I tried to downgrade «pip» but it doesn’t work and I faced «Non-zero exit code (2)» even for downgrading «pip»!
How can I solve the issue?

Thanks,

Source link

Related

Related Posts

python – Line plot with confidence intervals with period datatype on x-axis, seaborn vs pandas

September 24, 2022September 24, 2022 Uncategorized

Python 3 Exercise: What’s the difference between these two?

July 31, 2022July 31, 2022 Uncategorized

Solve derivatives on Python

October 18, 2022October 18, 2022 Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

command -v pip
/usr/local/bin/pip

command -v python
/usr/bin/python

# pip --version
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==1.5.6' distribution was not found and is required by the application

# python -m pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

# /usr/bin/python -m pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python
2.7)
# /usr/bin/python -m pip install --upgrade pip
The directory '/root/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/root/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

The never ending story..

Hi there!

So short Intro, I am making a python script/project for like a addon to the game «Elite Dangrous», To do this I am using basically a macro to accomplish the task, for those who know this game it’s basically a Fleet carrier auto Route plotter for long disctance trips.

The way the script works is it uses 2 librarys called «pyautogui» and «pydirectinput» to navigate the player UI and peform actions.

I decided to make this since i learned how to read csv files in my classes a few weeks ago.

the code runs fine, but the next step is to impliment the script into another program called EDMC(https://github.com/EDCD/EDMarketConnector) , that can run plugins that are fully written in python(https://github.com/EDCD/EDMarketConnector/blob/main/PLUGINS.md) I was asked to make the script a plugin so that more people can use it.

I have spent a few days trying to make it run, but I have now encountered an error that I have no idea how to fix ot troubleshoot.

subprocess.CalledProcessError: Command ‘[‘C:Program Files (x86)EDMarketConnectorEDMarketConnector.exe’, ‘-m’, ‘pip’, ‘install’, ‘pydirectinput’]’ returned non-zero exit status 2.

2021-03-02 14:15:05.670 — ERROR — plug.load_plugins:210: Failure loading found Plugin «FCjumper»

EDMC returns a text file with error codes when it runs and this is the extract, If i should post more of it please let me know and ill give the whole thing.

Here is the link to my Git hub which has the files, It is organized with 2 modules and a load.py file.The load file has the functions required for EDMC to recognise it.

https://github.com/Gorfs/FCAutojumper

i created a new branch REDDIT for yall to see the new files plus the full log for the error, in main there are my previous files, for the files without the EDMC mods, look for the GUI.py, Macro.py and main.py, files in the main branch and run those or alternativly run the FCautojumperandfueller.py to get all the functions in one file.

IF those interested want to try out the code without the plugins bits just call the make_GUI in the load file(make sure that you have all 3 files) and have fun

The second link should have everything required to understand how it works, so If you can understand it, it should give some explanations.

here is the link to a short plugin for EDMC that I am using to understand how to make my own work ,

https://github.com/Exynom/EDMC-HourlyIncome

And also second question would be how would i make it so that It could be its own standalone .exe? whenever I launch the file directly without an IDE it does nothing(when calling the make_GUI ) but when i run it using the IDE it all works? (just a little side question).

Final notes:

I know this is probably a dumb question but after a few hours of looking and only finding things that are WAY to complicated for me to understand i got a bit demotivated. And yes i know this isnt at all good compared to the other plugins, I just wanted to make a little thing to help the comunity out.

Anyway I hope that I didnt just turn people off from helping me with this massive hump of text, (if so, sorry) and of course if anyone wants to use the code to make anything they want you have my full consent, you may edit, copy, distribute as you wish but please add me as a contributor is so. :)

Good day (or night)

P.S if you have any problems seeing the files please comment and ill try to fix it as soon as possible thanks :)

btw if you post a response you are a boss :)

edit1: forgot to say, If anyone here can’t figure out what my crappy code means then post in the comments, I’ll try to answer question about what I made. :)

Понравилась статья? Поделить с друзьями:
  • Ntdll dll ошибка windows 10 скачать
  • Ntdll dll ошибка windows 10 appcrash
  • Nsurlerrordomain ошибка 999 что значит
  • Np 31730 4 ошибка ps4
  • Nsurlerrordomain ошибка 1012 что делать