Python中文
首页
教程
问答
标签
搜索
登录
注册
使用setuptools将numpy作为依赖项安装
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>这可能是一个关于<a href="https://stackoverflow.com/q/6623973/572616">this</a>的后续问题。</p> <p>我正在使用<a href="http://pypi.python.org/pypi/setuptools" rel="nofollow noreferrer">setuptools</a>安装我的软件包。作为依赖项,我列出了<a href="http://pypi.python.org/pypi/numpy" rel="nofollow noreferrer">numpy</a>。我用的是Python2.7</p> <pre><code>python setup.py install </code></pre> <p>使用这个<code>setup.py</code>文件:</p> <pre><code>from setuptools import setup setup(name = "test_pack", install_requires = ["numpy"]) </code></pre> <p>我最后得到的错误消息是:</p> <pre><code>ImportError: No module named numpy.distutils </code></pre> <p>为了将<code>numpy</code>包含为依赖项并在没有安装<code>python-dev</code>的情况下安装它,我需要做什么?</p> <hr/> <p>完全输出<code>python setup.py install</code>:</p> <pre><code>running install running bdist_egg running egg_info writing requirements to test_pack.egg-info/requires.txt writing test_pack.egg-info/PKG-INFO writing top-level names to test_pack.egg-info/top_level.txt writing dependency_links to test_pack.egg-info/dependency_links.txt reading manifest file 'test_pack.egg-info/SOURCES.txt' writing manifest file 'test_pack.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/test_pack copying build/lib/test_pack/__init__.py -> build/bdist.linux-x86_64/egg/test_pack copying build/lib/test_pack/mod.py -> build/bdist.linux-x86_64/egg/test_pack byte-compiling build/bdist.linux-x86_64/egg/test_pack/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/test_pack/mod.py to mod.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying test_pack.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying test_pack.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying test_pack.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying test_pack.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying test_pack.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO creating 'dist/test_pack-0.0.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing test_pack-0.0.0-py2.7.egg Copying test_pack-0.0.0-py2.7.egg to /home/woltan/local/lib/python2.7/site-packages Adding test-pack 0.0.0 to easy-install.pth file Installed /home/woltan/local/lib/python2.7/site-packages/test_pack-0.0.0-py2.7.egg Processing dependencies for test-pack==0.0.0 Searching for numpy Reading http://pypi.python.org/simple/numpy/ Reading http://numpy.scipy.org Reading http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Reading http://numeric.scipy.org Best match: numpy 1.6.1 Downloading http://pypi.python.org/packages/source/n/numpy/numpy-1.6.1.zip#md5=462c22b8eb221c78ddd51de98fbb5979 Processing numpy-1.6.1.zip Running numpy-1.6.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-AoFmdV/numpy-1.6.1/egg-dist-tmp-JH1j2R non-existing path in 'numpy/distutils': 'site.cfg' Could not locate executable g77 Found executable /opt/solstudio12.2/bin/f77 gnu: no Fortran 90 compiler found gnu: no Fortran 90 compiler found Found executable /opt/intel/Compiler/11.1/073/bin/intel64/ifort Could not locate executable lf95 Could not locate executable pgf90 Could not locate executable pgf77 Found executable /opt/solstudio12.2/bin/f90 Found executable /opt/solstudio12.2/bin/f95 Could not locate executable fort _configtest.c:1: warning: conflicting types for built-in function ‘exp’ _configtest.o: In function `main': /tmp/easy_install-AoFmdV/numpy-1.6.1/_configtest.c:6: undefined reference to `exp' collect2: ld returned 1 exit status _configtest.c:1: warning: conflicting types for built-in function ‘exp’ _configtest.c:1:20: error: Python.h: No such file or directory _configtest.o: In function `main': /tmp/easy_install-AoFmdV/numpy-1.6.1/_configtest.c:6: undefined reference to `exp' collect2: ld returned 1 exit status _configtest.c:1:20: error: Python.h: No such file or directory </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>除非您可以访问numpy的二进制发行版(预编译/编译),否则您必须拥有python头文件,因为它需要它们来构建numpy。这就是为什么大多数包管理器附带这些包的预编译版本。例如,您可以<code>apt-get install python-numpy</code>,将其链接到您的virtualenv中,并且当您尝试使用<code>install_requires=['numpy']</code>安装程序时,应该会看到它已经安装。</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
Django:。是不是“超级用户”字段不起作用
2 回答
Django:'DeleteQuery'对象没有属性'add'
6 回答
Django:'ModelForm'对象没有属性
2 回答
Django:'python manage.py runserver'返回'TypeError:'WindowsPath'类型的对象没有len()
5 回答
Django:'Python管理.pysyncdb'不创建我的架构表
6 回答
Django:'Python管理.py迁移“耗时数小时(和其他奇怪的行为)
1 回答
Django:'readonly'属性在我的ModelForm上不起作用
7 回答
Django:'RegisterEmployeeView'对象没有属性'object'
4 回答
Django:'str'对象没有属性'get'
1 回答
Django:'创建' 不能被指定为Order模型表单中的值,因为它是一个不可编辑的字段
8 回答
Django:“'QuerySet'类型的对象不是JSON可序列化的”
1 回答
Django:“'utf8'编解码器无法解码位置19983中的字节0xe9:无效的连续字节”,加载临时文件时
2 回答
Django:“<…>”需要有一个字段“id”的值,然后才能使用这个manytomy关系
8 回答
Django:“AnonymousUser”对象没有“get_full_name”属性
4 回答
Django:“ascii”编解码器无法解码位置1035中的字节0xc3:序号不在范围内(128)
10 回答
Django:“BaseTable”对象不支持索引
10 回答
Django:“collections.OrderedDict”对象不可调用
8 回答
Django:“Country”对象没有属性“all”
9 回答
Django:“Data”对象没有属性“save”
10 回答
Django:“datetime”类型的对象不是JSON serializab
2 回答