简体   繁体   中英

Python modules are installed but can't be imported

I'm a novice Python user and slowly going crazy over following problem: I installed a number of modules for Python 2.7 (win34) using pip. I confirmed that the modules are indeed installed. Then I import the modules in a .py script (using Atom editor):

import numpy as np
import pandas as pd
import fiona
import geopandas as gpd
import shapely

There is no problem with importing the first two modules, but fiona, geopandas and shapely trigger errors:

ImportError: No module named geopandas

I suspect the issue may be related to the different directories where the modules are stored, but not sure how to address this. I saw several similar questions, but no answers..Grateful for any tips!

There are two cases in this situation. It might be permission issue or owner issue.

  1. Check permission of installed module. And provide it all permission.

    chmod -R 777

  2. Second thing, it may be owner issue, might be you installed module using

    apt-get install module_name or pip install modual_name

try to install modual using sudo

sudo apt-get install module_name or sudo pip install modual_name

If above thing not worked for you just try with

sudo ln -s /usr/bin/python2.7 /usr/bin/python

it will tell system to find the default system python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM