Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在编译的Python 3.6中调试_cryptunicode错误——使用pydebug_Python_Python 3.x_Debugging_Utf 8_Crypt - Fatal编程技术网

在编译的Python 3.6中调试_cryptunicode错误——使用pydebug

在编译的Python 3.6中调试_cryptunicode错误——使用pydebug,python,python-3.x,debugging,utf-8,crypt,Python,Python 3.x,Debugging,Utf 8,Crypt,我已经编译了Python3.6,但是出现了一些错误,导致下面的代码失败 Python 3.6.0+ (default, Feb 25 2017, 12:10:05) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import _crypt

我已经编译了Python3.6,但是出现了一些错误,导致下面的代码失败

Python 3.6.0+ (default, Feb 25 2017, 12:10:05)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _crypt
>>> _crypt.crypt('', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 1: invalid start byte

更新:

>>> sys.path
['', 
 '/Users/andrei/Python/installed/lib/python36.zip',
 '/Users/andrei/Python/installed/lib/python3.6', 
 '/Users/andrei/Python/installed/lib/python3.6/lib-dynload', 
 '/Users/andrei/Python/installed/lib/python3.6/site-packages']
building '_crypt' extension
gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I./Include -I. -I/usr/local/include -I/Users/andrei/Python/cpython/Include -I/Users/andrei/Python/cpython -c /Users/andrei/Python/cpython/Modules/_cryptmodule.c -o build/temp.macosx-10.12-x86_64-3.6-pydebug/Users/andrei/Python/cpython/Modules/_cryptmodule.o
gcc -bundle -undefined dynamic_lookup -L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include build/temp.macosx-10.12-x86_64-3.6-pydebug/Users/andrei/Python/cpython/Modules/_cryptmodule.o -L/usr/local/opt/openssl/lib -L/usr/local/lib -o build/lib.macosx-10.12-x86_64-3.6-pydebug/_crypt.cpython-36dm-darwin.so
building '_csv' extension
$ ./python.exe -m test -j6 test_crypt
Run tests in parallel using 6 child processes
0:00:00 [1/1] test_crypt passed
1 test OK.

Total duration: 447 ms
Tests result: SUCCESS
\u crypt
扩展看起来没有问题


更新:

>>> sys.path
['', 
 '/Users/andrei/Python/installed/lib/python36.zip',
 '/Users/andrei/Python/installed/lib/python3.6', 
 '/Users/andrei/Python/installed/lib/python3.6/lib-dynload', 
 '/Users/andrei/Python/installed/lib/python3.6/site-packages']
building '_crypt' extension
gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -I/usr/local/opt/openssl/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I./Include -I. -I/usr/local/include -I/Users/andrei/Python/cpython/Include -I/Users/andrei/Python/cpython -c /Users/andrei/Python/cpython/Modules/_cryptmodule.c -o build/temp.macosx-10.12-x86_64-3.6-pydebug/Users/andrei/Python/cpython/Modules/_cryptmodule.o
gcc -bundle -undefined dynamic_lookup -L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include build/temp.macosx-10.12-x86_64-3.6-pydebug/Users/andrei/Python/cpython/Modules/_cryptmodule.o -L/usr/local/opt/openssl/lib -L/usr/local/lib -o build/lib.macosx-10.12-x86_64-3.6-pydebug/_crypt.cpython-36dm-darwin.so
building '_csv' extension
$ ./python.exe -m test -j6 test_crypt
Run tests in parallel using 6 child processes
0:00:00 [1/1] test_crypt passed
1 test OK.

Total duration: 447 ms
Tests result: SUCCESS


更新:当我删除
——pydebug

对我有效时,问题就消失了。请显示
sys.path
@kennytm的输出好吧,我开始了解出了什么问题……)编辑:嗯,香草3.6.0有类似的路径。编译后的Python和pyenv之间可能存在一些冲突,不确定……如果您找到了解决方案,请随意添加一个自我回答:)sys.path看起来正常,因此错误可能是由于您的
lib dynload/\u crypt.cpython-36m-darwin。因此
已损坏。@kennytm Ok,这不是我所希望的:)你知道什么会使_crypt腐败吗?@kennytm这是
——pydebug
。删除该参数“修复”了问题。