在通过pip安装pandas之后,我试着按these instructions运行pd.test()
,但得到的错误似乎表明缺少模块。安装了pytest和moto来解决前两个问题,看起来googlecomputeengine将是它正在寻找的下一个模块。是否有运行pd.test()
所需模块的列表?在
也许还有更好的办法。通常我只安装一个anaconda环境,但这是服务器上现有的python环境。在
谢谢。在
编辑:添加错误
Python 3.6.4 (default, Jan 16 2018, 13:13:52)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pandas as pd
In [2]: pd.test()
running: pytest --skip-slow --skip-network /opt/bitnami/python/lib/python3.6/site-packages/pandas
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.6.4, pytest-3.4.1, py-1.5.2, pluggy-0.6.0
rootdir: /opt/bitnami, inifile:
collected 0 items / 1 errors
================================================================================================================== ERRORS ===================================================================================================================
_____________________________________________________________________________________________________________ ERROR collecting _____________________________________________________________________________________________________________
../../../../python/lib/python3.6/site-packages/_pytest/config.py:329: in _getconftestmodules
return self._path2confmods[path]
E KeyError: local('/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io')
During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/_pytest/config.py:360: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local('/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io/conftest.py')
During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/_pytest/config.py:366: in _importconftest
mod = conftestpath.pyimport()
../../../../python/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
__import__(modname)
../../../../python/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:213: in load_module
py.builtin.exec_(co, mod.__dict__)
../../../../python/lib/python3.6/site-packages/pandas/tests/io/conftest.py:3: in <module>
import moto
../../../../python/lib/python3.6/site-packages/moto/__init__.py:8: in <module>
from .acm import mock_acm # flake8: noqa
../../../../python/lib/python3.6/site-packages/moto/acm/__init__.py:2: in <module>
from .models import acm_backends
../../../../python/lib/python3.6/site-packages/moto/acm/models.py:7: in <module>
from moto.ec2 import ec2_backends
../../../../python/lib/python3.6/site-packages/moto/ec2/__init__.py:2: in <module>
from .models import ec2_backends
../../../../python/lib/python3.6/site-packages/moto/ec2/models.py:13: in <module>
import boto.ec2
../../../../python/lib/python3.6/site-packages/boto/__init__.py:1216: in <module>
boto.plugin.load_plugins(config)
../../../../python/lib/python3.6/site-packages/boto/plugin.py:93: in load_plugins
_import_module(file)
../../../../python/lib/python3.6/site-packages/boto/plugin.py:75: in _import_module
return imp.load_module(name, file, filename, data)
../../../../python/lib/python3.6/imp.py:235: in load_module
return load_source(name, filename, file)
../../../../python/lib/python3.6/imp.py:172: in load_source
module = _load(spec)
/usr/lib/python2.7/dist-packages/google_compute_engine/boto/compute_auth.py:19: in <module>
from google_compute_engine import logger
E ModuleNotFoundError: No module named 'google_compute_engine'
During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../../../../python/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
../../../../python/lib/python3.6/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
../../../../python/lib/python3.6/site-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
../../../../python/lib/python3.6/site-packages/_pytest/main.py:411: in _recurse
ihook = self.gethookproxy(path)
../../../../python/lib/python3.6/site-packages/_pytest/main.py:315: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
../../../../python/lib/python3.6/site-packages/_pytest/config.py:343: in _getconftestmodules
mod = self._importconftest(conftestpath)
../../../../python/lib/python3.6/site-packages/_pytest/config.py:368: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: ModuleNotFoundError("No module named 'google_compute_engine'",)
E File "/opt/bitnami/python/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 213, in load_module
E py.builtin.exec_(co, mod.__dict__)
E File "/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io/conftest.py", line 3, in <module>
E import moto
E File "/opt/bitnami/python/lib/python3.6/site-packages/moto/__init__.py", line 8, in <module>
E from .acm import mock_acm # flake8: noqa
E File "/opt/bitnami/python/lib/python3.6/site-packages/moto/acm/__init__.py", line 2, in <module>
E from .models import acm_backends
E File "/opt/bitnami/python/lib/python3.6/site-packages/moto/acm/models.py", line 7, in <module>
E from moto.ec2 import ec2_backends
E File "/opt/bitnami/python/lib/python3.6/site-packages/moto/ec2/__init__.py", line 2, in <module>
E from .models import ec2_backends
E File "/opt/bitnami/python/lib/python3.6/site-packages/moto/ec2/models.py", line 13, in <module>
E import boto.ec2
E File "/opt/bitnami/python/lib/python3.6/site-packages/boto/__init__.py", line 1216, in <module>
E boto.plugin.load_plugins(config)
E File "/opt/bitnami/python/lib/python3.6/site-packages/boto/plugin.py", line 93, in load_plugins
E _import_module(file)
E File "/opt/bitnami/python/lib/python3.6/site-packages/boto/plugin.py", line 75, in _import_module
E return imp.load_module(name, file, filename, data)
E File "/opt/bitnami/python/lib/python3.6/imp.py", line 235, in load_module
E return load_source(name, filename, file)
E File "/opt/bitnami/python/lib/python3.6/imp.py", line 172, in load_source
E module = _load(spec)
E File "/usr/lib/python2.7/dist-packages/google_compute_engine/boto/compute_auth.py", line 19, in <module>
E from google_compute_engine import logger
============================================================================================================= warnings summary ==============================================================================================================
None
could not create cache path /opt/bitnami/.pytest_cache/v/cache/lastfailed
-- Docs: http://doc.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================================== 1 warnings, 1 error in 2.42 seconds ====================================================================================================
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
当前安装的软件包:
^{pr2}$
根据Pandas Documentation,以下是该模块的依赖项。在
我也遇到了同样的问题,我只是通过
PyCharm IDE
安装pandas来解决它。我不知道这会有什么区别,但是,它起作用了。在相关问题 更多 >
编程相关推荐