【问题标题】:Install Numeric (old numpy) and old version of Python (e.g. Py 2.4)安装 Numeric(旧 numpy)和旧版本的 Python(例如 Py 2.4)
【发布时间】: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


【解决方案1】:

Numeric 软件包可能在很久以前就被弃用了,请尝试在您的安装中安装 numpy 1.8 并在代码开头编写:

from numpy import oldnumeric as Numeric

对于old numpy做安装:

pip install numpy==1.8

【讨论】:

  • 我测试了你的答案,但它不起作用。至少 V 1.8 不是我们正在寻找的版本。
  • 但是,这并不能解决依赖于原始旧数字的包中的问题。一些库依赖于 Numeric 包中的 c 头文件。
【解决方案2】:

如果你想要真正的交易,为什么不使用 VirtualBox 创建一个虚拟容器并安装那个时代的 Linux 发行版,比如 Ubuntu 4.10

它有python2.3python-numeric 包。

【讨论】:

    猜你喜欢
    • 2015-02-10
    • 1970-01-01
    • 1970-01-01
    • 2016-08-17
    • 1970-01-01
    • 1970-01-01
    • 2020-08-17
    • 2018-01-20
    • 1970-01-01
    相关资源
    最近更新 更多