通过pip安装后,Python无法看到模块

时间:2019-10-25 15:48:29

标签: python pandas pip

我仍在尝试通过pip安装软件包的科学。当我运行pip安装地址解析器时,我得到以下信息:

(base) C:\Users\MBSanders>python -m pip install geocoder
Requirement already satisfied: geocoder in c:\programdata\anaconda3\lib\site-packages (1.38.1)
Requirement already satisfied: requests in c:\programdata\anaconda3\lib\site-packages (from geocoder) (2.21.0)
Requirement already satisfied: future in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.17.1)
Requirement already satisfied: click in c:\programdata\anaconda3\lib\site-packages (from geocoder) (7.0)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from geocoder) (1.12.0)
Requirement already satisfied: ratelim in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.1.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2019.3.9)
Requirement already satisfied: idna<2.9,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (3.0.4)
Requirement already satisfied: decorator in c:\programdata\anaconda3\lib\site-packages (from ratelim->geocoder) (4.4.0)

我跑步时

os.getcwd() 

在spyder / python中,我得到

'C:\\Users\\MBSanders'

我的问题是,我为什么得到

ModuleNotFoundError: No module named 'geocoder'

我跑步时

import geocoder

我是python的新手。请让我知道是否需要其他信息来排除故障。我在联邦机构内,所以我没有管理员权限。

当我在控制台中运行sys.path时,我得到

sys.path
Out[12]: 
['F:\\Users\\MBSanders',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\python37.zip',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3',
 '',
 'C:\\Users\\MBSanders\\AppData\\Roaming\\Python\\Python37\\site-packages',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\IPython\\extensions',
 'F:\\Users\\MBSanders\\.ipython']

2 个答案:

答案 0 :(得分:1)

假设您正在终端上运行python,并且python是用于运行它的命令,请尝试执行python -m pip install geocoder。将其安装到要使用的python构建中。或者,如果您知道正在使用的python构建的完整路径,则可以执行类似/path/to/python -m pip install geocoder的操作。

答案 1 :(得分:0)

如果您使用的是python 3.7或3.8,则可能需要pip3.7 or pip3.8 install(如果您的操作系统将2.x版本识别为默认版本)