Djangoお試し
WindowsでDjangoプロジェクト作成しようとしたらエラーになった。
C:\Users\Aho\app> pipenv run django-admin startproject hogeapp Exception in thread Thread-2 (_readerthread): Traceback (most recent call last): File "C:\Users\Aho\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\Aho\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "C:\Users\Aho\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1550, in _readerthread buffer.append(fh.read()) ^^^^^^^^^ File "<frozen codecs>", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8f in position 0: invalid start byte 'django-admin' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。
同一フォルダに".env"ファイルを配置して以下のように記述する(環境変数を設定する)
PYTHONUTF8=1
実行できた。
C:\Users\Aho\app> pipenv run django-admin startproject hogeapp Loading .env environment variables...