from .env_config import RRT_EPS, LIMITS, STICK_LENGTH ImportError: attempted relative import with no known parent package
时间: 2023-08-27 09:22:45 浏览: 54
It seems like you are encountering an error related to a relative import in Python. This error typically occurs when you are trying to import a module or package using a relative path, but Python cannot determine the parent package.
To resolve this issue, you can try the following solutions:
1. Update your import statement: Instead of using a relative import, you can try using an absolute import. For example, if your module is located in a package called "mypackage" and the module you want to import is in the same package, you can use the following import statement:
```python
from mypackage.env_config import RRT_EPS, LIMITS, STICK_LENGTH
```
2. Check your file structure: Ensure that the file you are running is placed in a package or module directory. Relative imports require a proper package structure.
3. Use the `-m` flag with `python`: If you are running your script using the `python` command, you can try using the `-m` flag to run your script as a module. For example:
```bash
python -m mypackage.myscript.py
```
By applying one of these solutions, you should be able to resolve the "attempted relative import with no known parent package" error.