我知道這是一個嚴重記錄的問題,但沒有發佈的解決方案已解決我的問題。試圖在setup.py中安裝numpy
這是我的代碼
#!/usr/bin/env python
import os
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
setup(
name='MLM',
version='0.2dev',
setup_requires=['numpy'],
cmdclass={'build_ext': build_ext},
install_requires=[
'nltk',
'numpy'
],
license='MIT',
long_description=open('../README.md').read,
)
然而,當我運行python setup.py install
我得到:
File "D:\python\lib\site-packages\setuptools\command\easy_install.py", line 1106, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
您是否按照說明安裝了MSVC++ 9? – lxop
@lxop這是可以添加到setup.py文件的東西嗎? – Kat