我有一些非常旧的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搜索数字(列出的数字24.2,但它拒绝使用命令
安装它pip install Numeric
最后,我尝试下载源代码,并在Active Py2.6环境中,运行
python setup.py install
我会收到以下错误:
running install
running build
running build_py
running build_ext
building 'umath' extension
C:UsersUSERNAMEAppDataLocalProgramsCommonMicrosoftVisual C++ for
Python9.0VCBinamd64cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -
DHAVE_INVERSE_HYPERBOLIC=0 -IInclude -IPackagesFFTInclude -
IPackagesRNGInclude "-IC:Program FilesAnaconda3envspy27rinclude" "-
IC:Program FilesAnaconda3envspy27rPC" /TcSrcumathmodule.c
/Fobuildtemp.win-amd64-2.7ReleaseSrcumathmodule.obj
umathmodule.c
Srcumathmodule.c(1005) : warning C4244: '=' : conversion from 'double' to
'float', possible loss of data
Srcumathmodule.c(1297) : warning C4146: unary minus operator applied to
unsigned type, result still unsigned
Srcumathmodule.c(2405) : error C2099: initializer is not a constant
Srcumathmodule.c(2405) : error C2099: initializer is not a constant
Srcumathmodule.c(2407) : error C2099: initializer is not a constant
Srcumathmodule.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 数字开发环境?
我的机器是一台64位Windows 10机器。
数字软件包可能是在很久以前剥夺的,请尝试在安装中安装numpy 1.8并在代码开始时写入:
from numpy import oldnumeric as Numeric
对于旧的numpy进行安装:
pip install numpy==1.8
如果您想要 real deal ,为什么不使用SAS VirtualBox创建虚拟容器并从那个时代安装Linux发行版,例如Ubuntu 4.10。
它具有python2.3
和python-numeric
软件包。