Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

python - ImportError: No module named 'pandas' (inside virtualenv)

I created a virtual environment named quora for python. I installed wheel and then pandas as instructed. I cant get pandas to work for some reason. Can someone help me. I have tried all the other solutions available to similar questions on this website. Still no use.

(quora) (jessie)griffith@localhost:~/environments$ sudo pip install wheel
Requirement already satisfied: wheel in /usr/lib/python2.7/dist-packages
(quora) (jessie)griffith@localhost:~/environments$ sudo pip install pandas
Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/dist-packages (from python-dateutil->pandas) 

(quora) (jessie)griffith@localhost:~/environments$ python getdata.py
Traceback (most recent call last):
  File "getdata.py", line 2, in <module>
    import pandas as pd
ImportError: No module named 'pandas'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Don't use sudo in a virtualenv — sudo pip install installs packages into global site-packages, not in virtualenv.

Either install pandas in the virtual environment (pip install after activating venv) or enable access to the global packages (recreate venv with option --system-site-packages or use command toggleglobalsitepackages from virtualenvwrapper).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...