我刚开始与泊坞和Django中。我尝试创建示例Django prodject,如下所示:https://docs.docker.com/compose/django多克尔-构成:在位置7“ASCII”编解码器不能解码字节0XCD:在范围序数不(128)
我制作了Dockerfile,requirements.txt和docker-compose.yml。但是,当我尝试使用泊坞窗,撰写命令来创建Django项目,我有一个错误:
docker-compose run web django-admin.py startproject MyProject .
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 64, in main
File "compose\cli\main.py", line 116, in perform_command
File "compose\cli\main.py", line 712, in run
File "compose\cli\main.py", line 1020, in run_one_off_container
File "compose\cli\main.py", line 1100, in call_docker
File "distutils\spawn.py", line 220, in find_executable
File "ntpath.py", line 85, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcd in position 7:
ordinal not in range(128)
Failed to execute script docker-compose
我尝试搜索了同样的问题,但没有什么帮助。
的Windows 10专业(英语不是系统语言,如果是很重要的)。
我的码头工人:
docker --version
Docker version 17.03.1-ce, build c6d412e
docker-compose --version
docker-compose version 1.11.2, build f963d76f
Dockerfile:
FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
requirements.txt:
Django
psycopg2
泊坞窗,compose.yml:
version: '2'
services:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
谢谢大家!
更新:ntpath.py,与线85的一部分,在加盟:
def join(path, *paths):
path = os.fspath(path)
if isinstance(path, bytes):
sep = b'\\'
seps = b'\\/'
colon = b':'
else:
sep = '\\'
seps = '\\/'
colon = ':'
try:
if not paths:
path[:0] + sep #23780: Ensure compatible data type even if p is null.
result_drive, result_path = splitdrive(path)
for p in map(os.fspath, paths):
p_drive, p_path = splitdrive(p)
if p_path and p_path[0] in seps:
# Second path is absolute
if p_drive or not result_drive:
result_drive = p_drive
result_path = p_path
continue
elif p_drive and p_drive != result_drive:
if p_drive.lower() != result_drive.lower():
# Different drives => ignore the first path entirely
result_drive = p_drive
result_path = p_path
continue
# Same drive in different case
result_drive = p_drive
# Second path is relative to the first
if result_path and result_path[-1] not in seps:
result_path = result_path + sep
result_path = result_path + p_path
## add separator between UNC and non-absolute path
if (result_path and result_path[0] not in seps and
result_drive and result_drive[-1:] != colon):
return result_drive + sep + result_path
return result_drive + result_path
except (TypeError, AttributeError, BytesWarning):
genericpath._check_arg_types('join', path, *paths)
raise
顶部是什么您正在尝试使Django项目进入的路径? –
这可能与您的系统语言有关。据推测,'ntpath.py'试图加入一个'',因为编码不正确而破坏了构建。不知道这是否是Docker-compose方面的问题,或者是您身边的问题,但我会建议您检查一下该字符(或其他字符)。然后将其编码或删除。 – Bono
在第一个地方 - C:\ Users \Наталья\ DoDj,然后我曾尝试从C:\ DoDj(为了逃脱kyrillic),但有同样的错误 – NaSt