【发布时间】:2017-05-03 03:05:03
【问题描述】:
我有一些非常古老的 Python 代码(大约在 Python 2.2/2.3 时代编写并使用我理解为 Numpy 前身的 Numeric 库)。我希望通过在 Python 3 和 Scipy 中重新编写来重新激发这一点,尽管我想让旧代码再次工作以进行测试。
我觉得这应该是可能的,因为开源软件通常会托管旧版本,尽管我在实现这一点时遇到了困难。
首先,我尝试使用 conda 创建 Py2.3 安装:
conda create -n py23 python=2.3
它找不到 Python 2.3。因此我创建了一个 Py2.7 环境。
在我的终端中使用 Py 2.7 活动环境,我可以看到使用 pip (pip search Numeric) 列出的 Numeric 24.2,但它拒绝使用命令安装它
pip install Numeric
最后,我尝试下载源代码并在一个活跃的 Py2.6 环境中运行
python setup.py install
我收到以下错误:
running install
running build
running build_py
running build_ext
building 'umath' extension
C:\Users\USERNAME\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -
DHAVE_INVERSE_HYPERBOLIC=0 -IInclude -IPackages\FFT\Include -
IPackages\RNG\Include "-IC:\Program Files\Anaconda3\envs\py27r\include" "-
IC:\Program Files\Anaconda3\envs\py27r\PC" /TcSrc\umathmodule.c
/Fobuild\temp.win-amd64-2.7\Release\Src\umathmodule.obj
umathmodule.c
Src\umathmodule.c(1005) : warning C4244: '=' : conversion from 'double' to
'float', possible loss of data
Src\umathmodule.c(1297) : warning C4146: unary minus operator applied to
unsigned type, result still unsigned
Src\umathmodule.c(2405) : error C2099: initializer is not a constant
Src\umathmodule.c(2405) : error C2099: initializer is not a constant
Src\umathmodule.c(2407) : error C2099: initializer is not a constant
Src\umathmodule.c(2407) : error C2099: initializer is not a constant
WARNING: '' not a valid package name; please use only .-separated package
names in setup.py
error: command
'C:\\Users\\USERNAME\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual
C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
有人可以告诉我哪里出错了吗?是否有可能从大约 2000 年代初开始设置 Python + Numeric 开发环境?
我的机器是 64 位 Windows 10 机器。
【问题讨论】:
-
任何适用于 Windows 或 Linux 的解决方案将不胜感激 - 我可以使用任何一个。谢谢!
标签: python-2.7 numpy python-2.x numeric