我已经安装了python 3.6.0,如果您使用的是python(> 3.3),则无需手动安装pip。但是当我试图访问pip(pip --version)时,它会抛出两个错误,主要与找不到模块有关。 描述如下。
C:\Users\sharma6>pip --version
Traceback (most recent call last):
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "c:\python360\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python360\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python360\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\python360\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python360\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ModuleNotFoundError: No module named 'urllib3'
即使我在python解释器中导入套接字(&gt;&gt;&gt;导入套接字),它也会显示“无法找到模块”错误。
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python352\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket
有人可以告诉我有关错误以及如何解决这些错误,因为我需要点才能正常工作。
答案 0 :(得分:1)
在系统变量中添加所有路径,而不是添加用户变量。 它对我有用!!! :)
答案 1 :(得分:0)
你应该尝试写
python -m pip --version
如果这会显示错误消息,请从https://pip.pypa.io/en/stable/installing/下载get-pip.py并使用
安装来安装pippython get-pip.py
然后通过
完成pip安装python -m pip install [package name]