gpt4 book ai didi

python-3.x - 编译python 3.6后缺少_socket

转载 作者:行者123 更新时间:2023-12-03 08:28:22 32 4
gpt4 key购买 nike

我尝试使用以下命令编译 python3.6:

emc@belvedere:~/py36/Python-3.6.0rc1> ./configure --prefix=/home/emc/py36 --with-system-expat --with-system-expat --with-system-ffi --disable-ipv6 && make && make install

编译成功我可以开始解释了:
emc@belvedere:~/py36/bin> ./python3.6
Python 3.6.0rc1 (default, Dec 14 2016, 13:08:45)
[GCC 4.8.1 20130909 [gcc-4_8-branch revision 202388]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

但:
emc@belvedere:~/py36/bin> pip3.6 
Traceback (most recent call last):
File "/home/emc/py36/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/home/emc/py36/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/emc/py36/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "/home/emc/py36/lib/python3.6/socket.py", line 49, in <module>
import _socket
ModuleNotFoundError: No module named '_socket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/emc/py36/bin/pip3.6", line 7, in <module>
from pip import main
File "/home/emc/py36/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/home/emc/py36/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/home/emc/py36/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
ModuleNotFoundError: No module named 'urllib3'

在配置过程中,我没有遇到任何问题:
http://pastebin.com/ePQ1awas

事实上,我可以在以下位置看到一些套接字库:
/home/emc/py36/lib64/python3.6/lib-dynload/_socket.cpython-36m-x86_64-linux-gnu.so

编辑:
无法导入套接字(线程相同)
>>> import _socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_socket'
>>>
>>>
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/emc/py36/lib/python3.6/socket.py", line 49, in <module>
import _socket
ModuleNotFoundError: No module named '_socket'

最佳答案

将/home/emc/py36/lib/python3.6/site-packages 添加到 PYTHONPATH 解决了问题。

关于python-3.x - 编译python 3.6后缺少_socket,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41146296/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com