Search code examples
pythoncmdpycharmkivy

OSError: [WinError 123] Syntax error in file name, folder name, or volume label


I am a beginner Python user. I ran into a problem when installing the "Kivy" package, even any package, I get an error "OSError: [WinError 123] Syntax error in file name, folder name, or volume label".

Here my error:

ERROR: Exception:
Traceback (most recent call last):
  File "D:\AHProject\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
  File "D:\AHProject\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "D:\AHProject\venv\lib\site-packages\pip\_internal\commands\install.py", line 553, in run
    self._handle_target_dir(
  File "D:\AHProject\venv\lib\site-packages\pip\_internal\commands\install.py", line 563, in _handle_target_dir
    ensure_dir(target_dir)
  File "D:\AHProject\venv\lib\site-packages\pip\_internal\utils\misc.py", line 105, in ensure_dir
    os.makedirs(path)
  File "D:\Python3.10\lib\os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "D:\Python3.10\lib\os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [WinError 123] Syntax error in file name, folder name, or volume label: 'D:\\AHProject\\~\\D:'

I have already shoveled the entire Internet but did not find a solution to the problem on my question. I'm working with PyCharm, but even when I try install package in cmd I have the same error.


Solution

  • The problem was solved by installing Anaconda and for me everything works now