如何在 pycharm 中授予 python 对所有文件的权限。我在 mac

问题描述 投票:0回答:0
from PIL import Image
import pytesseract

pytesseract.pytesseract.tesseract_cmd = '/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/__init__.py'


img = Image.open("test.jpeg")
print(img)
text = pytesseract.image_to_string(img)
print('Image text:', text)
Traceback (most recent call last):
  File "/Users/luksu/wwApp/Build/textRead.py", line 11, in <module>
    text = pytesseract.image_to_string(img)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/pytesseract.py", line 423, in image_to_string
    return {
           ^
  File "/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/pytesseract.py", line 426, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/pytesseract.py", line 288, in run_and_get_output
    run_tesseract(**kwargs)
  File "/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/pytesseract.py", line 255, in run_tesseract
    proc = subprocess.Popen(cmd_args, **subprocess_args())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 1901, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/Users/luksu/wwApp/venv/lib/python3.11/site-packages/pytesseract/__init__.py'

我已经尝试了几乎所有的方法来摆脱它,但到目前为止没有任何效果,我在 Mac 上并且是 python 和一般编码的新手所以这是我第一次遇到这种问题,我没有在任何地方找到有效的答案所以刚刚创建了我自己的帖子。

python-3.x tesseract permission-denied
© www.soinside.com 2019 - 2024. All rights reserved.