Это сообщение об ошибке ...
LookupError: unknown encoding: idna
... подразумевает, что между idna
и utf-8
была ошибка кодирования / декодирования .
Эта ошибка происходит из _get_idna_encoded_host(host)
метода models.py , который определяется следующим образом:
@staticmethod
def _get_idna_encoded_host(host):
import idna
try:
host = idna.encode(host, uts46=True).decode('utf-8')
except idna.IDNAError:
raise UnicodeError
return host
Немного деталей вашей системы в терминах ] архитектура и os помогли бы нам лучше отладить вашу проблему. Однако:
Решение заключается в добавлении следующего импорта:
import encodings.idna
Примечание : Убедитесь, что pip
находится в PATH и 9.0.1 или лучше.
64-битный MinGW , основанный на (только что выпущенном) gcc-4.4.0, вероятно, ваш лучший выбор. (Since the mingw-w64 project on sourceforge.net is moving to mingw-w64.org it's better to use mingw-w64.org)
Detailed instructions:
1. Download the archive
2. Extract it somewhere under cygwin. In my case, top-level cygwin directory is C:\cygwin
, I extracted the package into mingw
directory, and ended up with the following contents in C:\cygwin\mingw
(which is visible as /mingw
under cygwin:
$ ls -l /mingw
total 1
drwxr-xr-x+ 2 user None 0 May 10 08:32 bin
drwxr-xr-x+ 2 user None 0 May 10 05:45 include
drwxr-xr-x+ 2 user None 0 May 10 08:30 info
drwxr-xr-x+ 3 user None 0 May 10 08:30 lib
drwxr-xr-x+ 3 user None 0 May 10 05:45 libexec
drwxr-xr-x+ 4 user None 0 May 10 05:45 man
lrwxrwxrwx 1 user None 17 May 17 17:20 mingw -> x86_64-pc-mingw32
drwxr-xr-x+ 3 user None 0 May 10 04:16 share
drwxr-xr-x+ 5 user None 0 May 10 04:18 x86_64-pc-mingw32
3. Now compile some C++ code. I used:
// t.cc
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> vs;
vs.push_back("abc");
}
And compile it like this:
$ /mingw/bin/x86_64-pc-mingw32-g++ t.cc
4. Finally, verify the result is a Windows/x 64 executable, by running dumpbin /headers a.exe
:
Microsoft (R) COFF/PE Dumper Version 7.00.9466
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file a.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
8664 machine (AMD64)
10 number of sections
4A10AF9F time date stamp Sun May 17 17:45:19 2009
ABA00 file pointer to symbol table
EC4 number of symbols
F0 size of optional header
27 characteristics
Relocations stripped
Executable
Line numbers stripped
Application can handle large (>2GB) addresses
The gcc docs say:
These `-m' switches are supported in addition to the above on AMD x86-64 процессоры в 64-битных средах.
-m32 -m64 Сгенерировать код для 32-битной или 64-битной среды. 32-битный окружение устанавливает int, long и указатель до 32 бит и генерирует код, который работает на любой системе i386. 64-битный окружение устанавливает int равным 32 битам и длинный и указатель на 64 бита и генерирует код для AMD x86-64
Обратите внимание, что, я думаю, это сведет вас с ума, если mingw действительно так поступает, поскольку обычно в Windows 64 long - это 32 бита, а long long - это 64-битный размер указателя типа.