python-2.7 – 安装Numeric(old numpy)和旧版本的Python(例如Py 2.4)

我有一些非常古老的
Python代码(围绕
Python 2.2 / 2.3时编写并使用我理解的数字库是Numpy的前身).我希望通过在Python 3和Scipy中重新编写来重新激活它,尽管我想让旧代码再次用于测试目的.

我觉得这应该是可能的,因为开源软件经常保留托管的旧版本,尽管我无法实现这一点.

首先,我尝试使用conda来创建Py2.3安装:

conda create -n py23 python=2.3

它找不到Python 2.3.因此,我创建了一个Py2.7环境.

在我的终端中使用Py 2.7活动环境按下,我可以看到使用pip(pip搜索数字)列出的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

有人可以告诉我哪里出错了吗?甚至可以从大约21世纪初开始设置Python数字开发环境吗?

我的机器是64位Windows 10机器.

最佳答案 Numeric包可能在很久以前被删除了,请尝试在您的安装中安装numpy 1.8并在代码的开头写入:

从numpy import oldnumeric作为Numeric

对于old numpy做的安装:

pip install numpy == 1.8

点赞