【发布时间】:2015-08-17 08:18:18
【问题描述】:
我目前正在为 Pandas 核心编写一些代码,我想知道我的工作流程是否正确。
由于 Travis CI 实例针对不同版本的 Python 进行测试,我设置了 conda 以在本地在不同版本之间切换,以便查看测试套件是通过还是失败。
但是每次我在环境之间切换时都会得到:
ERROR: Failure: ImportError (C extension: libpython2.6.so.1.0: cannot open shared object file: No such file or directory not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.)
当我做python setup.py build_ext --inplace 时,我得到:
/home/some_user/anaconda/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg/setuptools/dist.py:294: UserWarning: The version specified ('0.16.2-134-g84d6eba') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
running build_ext
skipping 'pandas/index.c' Cython extension (up-to-date)
skipping 'pandas/src/period.c' Cython extension (up-to-date)
skipping 'pandas/algos.c' Cython extension (up-to-date)
skipping 'pandas/lib.c' Cython extension (up-to-date)
skipping 'pandas/tslib.c' Cython extension (up-to-date)
skipping 'pandas/parser.c' Cython extension (up-to-date)
skipping 'pandas/hashtable.c' Cython extension (up-to-date)
skipping 'pandas/src/sparse.c' Cython extension (up-to-date)
skipping 'pandas/src/testing.c' Cython extension (up-to-date)
skipping 'pandas/msgpack.cpp' Cython extension (up-to-date)
因此,根据@Jeff 对this question 的评论,我使用以下方法重建扩展:
python setup.py build_ext --inplace --force
一切正常。但是构建需要几分钟才能运行,感觉就像我做错了什么。 (Contributing to Pandas 指南中当然没有提到必须强制重建。
所以我做错了什么,或者这就是它的工作方式?
【问题讨论】: