2017-02-09 118 views
0

我已經安裝了python 3.6.0,如果您使用python(> 3.3),則不需要手動安裝pip。但是當我試圖訪問點(pip --version)時,它會引發兩個主要與找不到模塊有關的錯誤。 說明如下。Python:pip已安裝,但無法在windows工作

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解釋器插座(>>>進口插座),這表明我「無法找到模塊」錯誤。

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

有人能告訴我有關的錯誤,以及如何,因爲我需要個點才能正常工作來解決這些問題。

回答

1

將您的所有路徑添加到您的系統變量而不是添加在用戶變量中。 它爲我工作! :)

+0

感謝您的回覆。它在環境設置中將用戶變量的lib路徑更改爲系統變量時起作用。 –

0

你應該嘗試寫

python -m pip --version 

如果給出錯誤信息,從https://pip.pypa.io/en/stable/installing/下載get-pip.py安裝點子並與

python get-pip.py 

與PIP安裝,然後安裝完成通過

python -m pip install [package name] 
+0

感謝您的回覆。我已經嘗試使用「python get-pip.py」 也安裝,但仍然有相同的錯誤「無法找到模塊_socket」。 –