Errno 2 no such file or directory python как исправить pycharm
Перейти к содержимому

Errno 2 no such file or directory python как исправить pycharm

  • автор:

PyCharm Python project Нет такого файла или каталога

При попытке запустить проект в PyCharm я получаю следующую ошибку. Я установил виртуальный бокс, бродягу и все требования в файле readme, который они мне дали, но при нажатии пробега.

[EDIT] Похоже, что сопоставления VM-брандмауэров неправильно настроены/установлены.

Любые идеи, почему это сводит меня с ума?

Я использую Mac OS X 10.9.2 и последнюю среду разработки PyCharm.

/ Проекты / PythonProj / manage.py. Я клонировал его из репозитория Git!

5 ответов

Начинал иметь ту же проблему после обновления до PyCharm 3.4 — до этого все работало нормально, а после обновления — ту же ошибку. Также исправлено путем обновления сопоставлений пути: перейдите в «Запуск/отладка конфигураций» и вручную определите сопоставления пути. Локальный путь должен быть контуром вашего проекта Django и удаленного пути к пути к проекту в бродящей виртуальной машине.

Другой способ добавления добавить корневой контекст проекта в настройках.

Изображение 161676

Эта проблема обычно возникает, когда u обновляет версию python и удаляет старый каталог python.

Возможно, вы сможете решить проблему, создав новый проект с pycharm и скопировав все файлы в скрывающемся каталоге с именем «.idea» в новом каталоге проекта в каталог старых проектов «/.idea» и выберите заменить.

Надеюсь, что это поможет, и простите моего бедного английского

Я получаю эту проблему всякий раз, когда я перемещаю папку проекта. Я обнаружил, что проблема в том, что сопоставленная папка на виртуальной машине больше не доступна; ls показывает следующее:

/src$ ll ls: cannot access ralph: No such file or directory total 8 drwxr-xr-x 3 root root 4096 Jan 11 07:42 ./ drwxr-xr-x 15 vagrant vagrant 4096 Mar 7 09:45 ../ d. ? ? ? ? ? ralph/

Решение имеет вид a vagrant reload . После этого перемещенная папка правильно отображается.

Поскольку вы упоминаете, что ваша установка включает виртуальную коробку и бродягу, вы может потребоваться обновить сопоставления пути в вашем Vagrantfile. В моем случае добавление синхронизированных путей между хостом и бродягой, например

[Errno 2] No such file or directory appears using pycharm remote debugging server code

When using pycharm (professional version) to connect to the server code remotely, it is clearly confirmed that there is no error in the local and server directories, and the path of the interpreter is also set to the correct path on the server, and an error is still reported No such file or directory

solution:

  1. Recheck whether your mapping is correct:


  2. The above situation is relatively easy to solve. After checking the information, everyone will definitely try again and again. The second problem (also the problem that bloggers have been confused for super long time) is actually very simple, that is, bloggers try to use an interpreter in an environment. Set two mappings, you will also see two identical interpreters in the python intepreter, but the second one may be followed by one (2) , This will often cause problems. If you have checked a lot of information but still can’t find a solution, you might as well try to use different interpreters for different projects (don’t ask me what if I want to use one, just build a exactly the same hhhh)

Fixing Python Error: Can't Open File 'setup.py': [Errno 2] No Such File or Directory

Gary Vanpelt

If you are a Python developer, you might have come across an error message that says «Can’t open file ‘setup.py’: [Errno 2] No such file or directory». This error message indicates that Python is unable to find the setup.py file in the specified location. This guide will provide you with a step-by-step solution to fix this error.

What is the setup.py file?

The setup.py file is a Python script that defines the metadata for your Python package. It includes information such as the package name, version, author, and dependencies. The setup.py file is required if you want to distribute your Python package using tools like pip.

Why am I getting the «Can’t open file ‘setup.py’: [Errno 2] No such file or directory» error?

You might be getting this error for several reasons. Some of the common reasons are:

  • The setup.py file is not located in the specified directory.
  • The setup.py file is located in a different directory.
  • The setup.py file is not named correctly.
  • The directory containing the setup.py file is not included in the PYTHONPATH environment variable.

How to fix the «Can’t open file ‘setup.py’: [Errno 2] No such file or directory» error?

To fix this error, follow these steps:

Check if the setup.py file is located in the specified directory.

This command will list all the files in the specified directory. Make sure that the setup.py file is present in the directory.

Check if the setup.py file is located in a different directory.

If the setup.py file is located in a different directory, you need to navigate to that directory before running the setup.py file. Use the following command to navigate to the directory:

Once you are in the directory that contains the setup.py file, you can run the file using the following command:

Check if the setup.py file is named correctly.

Make sure that the setup.py file is named correctly. The file name should be «setup.py» and not «setup.py.txt» or «setup.py.doc».

Check if the directory containing the setup.py file is included in the PYTHONPATH environment variable.

The PYTHONPATH environment variable is used by Python to look for modules and packages. If the directory containing the setup.py file is not included in the PYTHONPATH environment variable, Python will not be able to find the file. To include the directory in the PYTHONPATH environment variable, use the following command:

Replace «/path/to/directory/» with the actual path to the directory containing the setup.py file.

Q1. How do I know if the setup.py file is located in the specified directory?

You can use the following command to list all the files in the specified directory:

If the setup.py file is present in the directory, it will be listed in the output.

Q2. What should I do if the setup.py file is located in a different directory?

You need to navigate to the directory that contains the setup.py file before running the file. Use the following command to navigate to the directory:

Once you are in the directory that contains the setup.py file, you can run the file using the following command:

Q3. What should I do if the setup.py file is named incorrectly?

Make sure that the setup.py file is named correctly. The file name should be «setup.py» and not «setup.py.txt» or «setup.py.doc».

Q4. What is the PYTHONPATH environment variable?

The PYTHONPATH environment variable is used by Python to look for modules and packages. If the directory containing the setup.py file is not included in the PYTHONPATH environment variable, Python will not be able to find the file.

Q5. How do I include the directory containing the setup.py file in the PYTHONPATH environment variable?

Use the following command to include the directory in the PYTHONPATH environment variable:

Run your code

Łukasz Rogalski 20842

Similar question

For those who meet the problem like "miniconda3/envs/gpu/bin/python: can't open file '///home/. /test.py", you can just run the python script file in locality in pycharm rather than run the file in server in pycharm.

vegdog 9

It can be caused by one of the following:

1. You did not deploy your code on the remote server.!

  • Make sure that the recent edition of your code is deployed on the server. You can always deploy your code from Tools -> Deployment -> Upload to . or by using Ctrl + Shift + Alt + x.
  • For setting the deployment path, Go to File -> Settings -> Build, Execution, Deployment -> Deployment, and enter a remote sever details as your deploying machine.
  • In the Mappings tab, make sure that the deployment path is defined somewhere on the server where you have permission to read and edit files there.

2. You do not have the permission to read and change files on your deployment path at the remote server.

  • Go back to File -> Settings -> Build, Execution, Deployment -> Deployment, and change deployment path on the Mappings tab.

Redfox-Codder 173

I'm running PyCharm 2018.3

The Problem:

First, I didn't have the [Errno 2] No such file or directory problem. Then I had the problem out of nowhere.

The issue arose when I did:

  • Preferences -> Project: -> Project Interpreter
  • Instead of "Click on cog icon and select Add Remote", I chose a interpreter that I've configured previously (that is working fine previously) from the drop down menu

By doing the steps above, I had [Errno 2] No such file or directory problem.

The reason is that the folder is not automatically synced to the remote server (a bug?), nor could I find a way to configure it to sync. Configuring Deployment and Path Mappings did work, but it's too much manual labor and prone to error.

The solution:

All I had to do is to add a new remote interpreter, despite that identical configurations already exists previously. (To be safe, I did remove the old ssh interpreter and the old deployments, also removed .idea folder) Then everything worked as expected.

  • I didn't need to configure Deployment
  • I didn't need to configure Paths mappings

Sida Zhou 3271

Be sure your interpreter is chosen as SSH which is to compile, not STFP which is for deployment.

enter image description here

snr 16774

Sometimes you can have everything set up correctly (interpreter, deployment, Path mapping, etc) but PyCharm keeps trying to use your local path on the remote machine.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *