最近要用 astropy 做点东西,2.7 用 pip 装上以后还装了一大堆额外的包,然而还是不好用……
AstroT4:~ zachary$ python test.py
'import sitecustomize' failed; use -v for traceback
Traceback (most recent call last):
File "test.py", line 4, in <module>
from astropy import units as u
File "/usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/__init__.py", line 116, in <module>
_check_numpy()
File "/usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/__init__.py", line 110, in _check_numpy
raise ImportError(msg)
ImportError: Numpy version 1.9.0 or later must be installed to use Astropy
AstroT4:~ zachary$ pip show numpy
'import sitecustomize' failed; use -v for traceback
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Name: numpy
Version: 1.14.1
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: NumPy Developers
Author-email: [email protected]
License: BSD
Location: /usr/local/lib/python2.7/site-packages
Requires:
Required-by: pyfits, matplotlib, astropy
简直不可理喻(我估计现在向任何人提关于 2.7 的 bug 都不会有反馈的)
然后换 python3,pip 只装了一个 astropy 包,运行起来没有任何问题😃
1
lihongjie0209 2019-12-12 13:14:47 +08:00
对于你这种类型的用户来说是可以升级到 python3
但是对于运维来说, 系统自带什么版本就用什么版本,CentOS 7 到现在还是 2.7, 只要 CentOS 7 还在线上跑, 我估计 2.7 要会用下去 |