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,70311 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 в нужной вам директории, так что ваша директория проекта будет похожа на те, которые вы можете найти в обучающих видео.

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

Whenever I am trying to run a object detection program in pycharm, the following error occurs (see the trace). Could you please help to figure out, how to fix it?

C:UsersDellvenvScriptspython.exe "C:Program FilesJetBrainsPyCharm Community Edition 2018.3.4helperspydevpydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 11093 --file C:/Users/Dell/Desktop/image.py
pydev debugger: process 2648 is connecting

Connected to pydev debugger (build 183.5429.31)
usage: image.py [-h] -i IMAGE -p PROTOTXT -m MODEL [-c CONFIDENCE]
image.py: error: the following arguments are required: -i/--image, -p/--prototxt, -m/--model

Process finished with exit code 2

Actually i am trying to run the code in the following page

https://www.pyimagesearch.com/2017/09/11/object-detection-with-deep-learning-and-opencv/
My question is where should i copy and paste …….python deep_learning_object_detection.py
—prototxt MobileNetSSD_deploy.prototxt.txt
—model MobileNetSSD_deploy.caffemodel —image images/example_01.jpg

asked Feb 21, 2019 at 9:15

rudra sarkar's user avatar

rudra sarkarrudra sarkar

111 gold badge1 silver badge3 bronze badges

2

In PyCharm, in the Run menu, look for Edit configurations...

Each time you run a new script, a run configuration is created for it and it is here that you can provide command line parameters in the Parameters: box.

You probably only want to past the parameters section there, not the script name, so:

 --prototxt MobileNetSSD_deploy.prototxt.txt  --model MobileNetSSD_deploy.caffemodel --image images/example_01.jpg

Another issue you may run into is what working directory your script needs to run in. You can change it from the same dialog, under Working directory:. You’ll find that you’ll rarely need to change any of the other fields in this dialog, although I would recommend giving it a name that’s sensible to you under Name: — by default it’s named after the script file it is running.

answered Feb 22, 2019 at 3:44

Grismar's user avatar

GrismarGrismar

27k4 gold badges31 silver badges54 bronze badges

1

Понравилась статья? Поделить с друзьями:
  • Non hp supply installed ошибка что делать
  • Nokiasoftwarerecoverytoolinstaller ошибка 0x80070002
  • Nokia software recovery tool ошибка 0x80070002
  • Nokia 515 ошибка 005
  • Noisecancelingengine exe ошибка приложения