Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no yolov5_in_syspath in yolov5.utils.general #1

Open
wuyuwangqingtian opened this issue Dec 29, 2021 · 3 comments
Open

no yolov5_in_syspath in yolov5.utils.general #1

wuyuwangqingtian opened this issue Dec 29, 2021 · 3 comments

Comments

@wuyuwangqingtian
Copy link

Hello, I made an error while running your code。
ImportError: cannot import name 'yolov5_in_syspath'

@Hopesun-ice
Copy link

i meet the same questions, and how to solve this ?

@yangkuo12
Copy link

me too, i also meet the same question and can not solve this problem so far

@swy767
Copy link

swy767 commented Feb 25, 2023

I think this issue is due to differences in the code of different versions of yolov5. You can solve this problem by adding a little code in yolov5.utils.general.

def yolov5_in_syspath():
    yolov5_folder_dir = str(Path(__file__).parents[1].absolute())
    try:
        sys.path.insert(0, yolov5_folder_dir)
        yield
    finally:
        sys.path.remove(yolov5_folder_dir)

imshow_ = cv2.imshow  # copy to avoid recursion errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants