Python: pip is installed but not working in window

2019-03-05 07:04发布

I have installed python 3.6.0, you don't need to install pip manually if you are using python (>3.3). But When I am trying to access pip (pip --version), it throws me two errors which mainly relate to not finding the module. Description is given below.

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'

Even when I import socket (>>>import socket)in python interpreter , It shows me "Can not found the module" error .

>>> 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

Could someone tell me about the errors and how to resolve them because I need pip to work properly.

2条回答
趁早两清
2楼-- · 2019-03-05 07:34

Add your all path in your system variable instead of adding in user variable. It worked for me!!! :)

查看更多
一夜七次
3楼-- · 2019-03-05 07:45

You should try to write

python -m pip --version

If this gives an error message, install pip by downloading get-pip.py from https://pip.pypa.io/en/stable/installing/ and install with

python get-pip.py

Installing with pip is then done by

python -m pip install [package name]
查看更多
登录 后发表回答