寻求有关安装numpy扩展程序的帮助

时间:2017-08-09 20:21:31

标签: python python-3.x numpy

我在github上发现了一个numpy扩展,这对我正在编写的程序非常有帮助,但是我不知道如何安装它。

以下是扩展程序的链接:https://pypi.python.org/pypi?name=py_find_1st&:action=display

我正在使用Windows 10,这可能是安装程序提供的原因不起作用的原因,我发现文件看起来像一个numpy扩展,如下所述:https://docs.scipy.org/doc/numpy-1.10.0/user/c-info.how-to-extend.html

但是在这个页面上没有提到在哪里放置numpy扩展的代码,我没有设法在线找到任何解释。

有人会知道如何安装吗?

2 个答案:

答案 0 :(得分:1)

要为Python构建任何扩展模块,您需要C compiler。各种NumPy模块使用FORTRAN 77库,因此您还需要安装FORTRAN 77编译器。

但是,如果您只想安装他们在网站上的tar.gz文件,请按照以下步骤操作:

  1. 打开cmd(命令提示符)
  2. 撰写set path=%path%;C:\Python27\
  3. 提取tar.gz文件(使用像PeaZip这样的程序)
  4. 更改命令行中的目录(如果您对如何执行此操作感到困惑here以供参考)
  5. 转到您的文件目录(类似cd c:\Users\pdxNat\Downloads\py_find_1st1.0.6
  6. 运行python setup.py install

答案 1 :(得分:0)

尝试使用cmd:

安装扩展程序时出现错误消息
D:\Chrome dl\py_find_1st-1.0.6\py_find_1st-1.0.6>python setup.py install
running install
running bdist_egg
running egg_info
creating py_find_1st.egg-info
writing py_find_1st.egg-info\PKG-INFO
writing dependency_links to py_find_1st.egg-info\dependency_links.txt
writing top-level names to py_find_1st.egg-info\top_level.txt
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
reading manifest file 'py_find_1st.egg-info\SOURCES.txt'
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\utils_find_1st
copying utils_find_1st\__init__.py -> build\lib.win-amd64-3.5\utils_find_1st
running build_ext
Traceback (most recent call last):
  File "setup.py", line 117, in <module>
    zip_safe = False,
  File "D:\Anaconda\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Anaconda\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 67, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 109, in do_egg_install
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 161, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 147, in call_command
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install_lib.py", line 11, in run
  File "D:\Anaconda\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\distutils\command\build_ext.py", line 338, in run
    self.build_extensions()
  File "setup.py", line 42, in build_extensions
    if compiler_is_clang(self.compiler.compiler):
AttributeError: 'MSVCCompiler' object has no attribute 'compiler'