我为python创建了一个名为quora的虚拟环境。我安装了车轮,然后按照指示安装了熊猫。由于某种原因,我无法让熊猫上班。有人能帮我吗。我已经尝试了该网站上针对类似问题的所有其他解决方案。还是没用。
(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'
不要在virtualenv中使用sudo-sudo pip install将软件包安装到global中site-packages,而不是在virtualenv中。
sudo pip install
site-packages
(pip install在激活venv之后)在虚拟环境中安装熊猫或启用对全局软件包的访问(使用option重新创建venv--system-site- packages或使用toggleglobalsitepackagesvirtualenvwrapper中的命令)。
pip install
--system-site- packages
toggleglobalsitepackages