Pycharm ошибка не удается найти указанный файл

I have a PyCharm project on my Windows, where I am able to run most .py files by pressing Ctrl + Shift + F10 (or running the debugger). In one of the files however I get the error

Error running 'test':
Cannot run program  "\opt\anaconda\bin\python" (in directory "..."): CreateProcess error=2, the system cannot find the file specified.`

The test.py file right now only contains print('hello')

I can do this for the other files, and using ‘Execute selection in console’ also works fine. Given I am on a Windows machine the "\opt\anaconda\bin\python" part looks suspicious, but I don’t know how to fix it.

Any help?


Copying the content to another file (e.g. test_2.py) ‘fixes’ the problem, but since this is a collaborative project this isn’t viable.

Error Detail

When I try to run python in PyCharm. The error occurred as below. What is venv\Scripts\python.exe?

Error running 'easy_keymaps_ui': Cannot run program "C:\Users\<USER_NAME>\source\test\venv\Scripts\python.exe" (in directory "C:\Users\<USER_NAME>\source\test"): CreateProcess error=2, The system cannot find the file specified

Environment

Windows 10
PyCharm 2020.3
Python 3.8

Cause

The python specified to use as interpreter in PyCharm cannot be found. In my case, the specified python is python that is bundled to the deleted virtual env of PyCharm project.
Check “Configure a virtual environment” for details about virtual env of PyCharm.

Solution

Change the python to use

Right click the program to run. And click “Modify Run Configuratuib…”

Select valid interpreter and click ”OK”.

How to remove and add python interpreters to the project

Open “File > Settings > Python Interpreter”. Click the gear icon and click “Show All” button.

Click “-” button to delete invalid Python.

And click “+” button to add new valid python to use to run python program. I selected my local system python.

After updating my Windows laptop, I tried running my PyCharm programs. However I pressed run and got this error

«Error:Cannot run program «C:\Users\user\Desktop\PyCharm\Scripts\python.exe» (in directory «C:\Users\user\PycharmProjects\pythonProject»): CreateProcess error=2, The system cannot find the file specified». I went into edit configurations and saw this «[invalid] Project Default (Python 3.9 (PyCharm)) C:\Users\user\Desktop\PyCharm\Scripts\python.exe».

bad_coder's user avatar

bad_coder

11.3k20 gold badges44 silver badges72 bronze badges

asked Mar 5, 2021 at 10:02

Graham O'Connor's user avatar

0

answered Mar 5, 2021 at 12:57

user2235698's user avatar

user2235698user2235698

7,0811 gold badge19 silver badges27 bronze badges

Error Detail

When I try to run python in PyCharm. The error occurred as below. What is venvScriptspython.exe?

Error running 'easy_keymaps_ui': Cannot run program "C:Users<USER_NAME>sourcetestvenvScriptspython.exe" (in directory "C:Users<USER_NAME>sourcetest"): CreateProcess error=2, The system cannot find the file specified

Environment

Windows 10
PyCharm 2020.3
Python 3.8

Cause

The python specified to use as interpreter in PyCharm cannot be found. In my case, the specified python is python that is bundled to the deleted virtual env of PyCharm project.
Check “Configure a virtual environment” for details about virtual env of PyCharm.

Solution

Change the python to use

Right click the program to run. And click “Modify Run Configuratuib…”

Select valid interpreter and click ”OK”.

How to remove and add python interpreters to the project

Open “File > Settings > Python Interpreter”. Click the gear icon and click “Show All” button.

Click “-” button to delete invalid Python.

And click “+” button to add new valid python to use to run python program. I selected my local system python.

Помогаю со студенческими работами здесь

Макрос, который находит все полужирные выделения
Есть кусок макроса. По идее он должен находить все полужирное выделение и ограничивать его тэгами…

Как сделать макрос который находит определенное слово
как сделайть макрос который находит определнное слово во всем тексте ворд, и разукрашевает его в…

Алгоритм,который находит и выводит третий максимум массива
Нужно написать программу-алгоритм,который находит и выводит третий максимум массива.

Напишите макрос, который находит максимальные элементы массивов
Даны два линейные массива А(n) и B(n). Напишите макрос, который находит максимальные элементы…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

2

1. Феномен

Система предлагает найти указанный файл:

Ошибка запуска «Привет»: не может запустить программу «x: xxx scripts python3.exe» (в каталоге » file name»): createProcess error = 2, система не может найти указанный файл python3.exe.

2. причина

Среда компиляции Python была перемещена по этой позиции

3. Решение

(1) Откройте меню «Файл -Setting».

(2) Найти «интерпретатор проекта», а затем выберите весь дисплей, как показано ниже:

(3) Нажмите на настройки в форме передачи в верхнем правом углу, выберите больше и отображение, как показано ниже

(4) Нажмите « -« В правом верхнем углу, чтобы удалить предыдущую среду компиляции Python. Если вы не знаете, какой из них неправ, вы можете удалить ее.

(5) Нажмите «+» в правом верхнем углу, чтобы добавить новую среду компиляции Python и выберите свою собственную среду компиляции Python локально

(6) Перезапустите Pycharm, снова запустите файл и обнаружите, что ошибка исчезает

Понравилась статья? Поделить с друзьями:
  • Pycharm ошибка интерпретатора python
  • Pycharm ошибка please select a valid python interpreter
  • Ps5 ошибка nw 102308 4
  • Pycharm ошибка no module named
  • Ps5 ошибка ce 118307 0