运行'python setup.py develop'或'python setup.py install'时,我会收到以下回溯。
Traceback (most recent call last):
File "setup.py", line 38, in <module>
test_suite='nose.collector',
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 27, in run
self.install_for_development()
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 129, in install_for_development
self.process_distribution(None, self.dist, not self.no_deps)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 682, in process_distribution
[requirement], self.local_index, self.easy_install
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/pkg_resources.py", line 631, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/pkg_resources.py", line 871, in best_match
return self.obtain(req, installer)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/pkg_resources.py", line 883, in obtain
return installer(requirement)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 595, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 627, in install_item
self.process_distribution(spec, dist, deps)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 659, in process_distribution
self.install_egg_scripts(dist)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 152, in install_egg_scripts
return easy_install.install_egg_scripts(self,dist)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 532, in install_egg_scripts
self.install_wrapper_scripts(dist)
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 734, in install_wrapper_scripts
for args in get_script_args(dist):
File "/local/home/kassan1/venvs/some_env/local/lib/python2.7/site-packages/pbr/packaging.py", line 512, in override_get_script_args
header = easy_install.get_script_header("", executable, is_wininst)
AttributeError: 'NoneType' object has no attribute 'get_script_header'
有趣的是,如果我重新运行与上面相同的命令,则安装成功。
只是为了解决问题,我尝试在导入和使用easy_install时将调试语句添加到pbr / packaging.py文件中。它在导入时看起来很好,但是当按照回溯在第512行访问时为None。
以下是我正在使用的要求文件:
pyyaml
requests
termcolor
mock
nose
cached_property
argparse
unittest2
tox
stevedore
kombu
和setup.py脚本:
import ez_setup
ez_setup.use_setuptools('3.6')
import os
from setuptools import setup, find_packages
try:
# workaround for http://bugs.python.org/issue15881
import multiprocessing # noqa
except ImportError:
pass
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements():
return read('requirements.txt').splitlines()
setup(
name='MY_PROJECT',
version='0.0.1',
author="Noorez Kassam",
long_description=read('README.rst'),
install_requires=requirements(),
entry_points={
'console_scripts': [
'myproj = myproj.myproj:main',
],
'myproj.urloperations.download': [
'file = myproj.filedownload:download'
],
},
packages=find_packages(),
test_suite='nose.collector',
)
Google上的快速搜索表明其他人遇到了我所看到的变化,但我无法找到问题的解决方案。
答案 0 :(得分:0)
我遇到了一个非常类似的问题并找到了解决方法。
我也得到AttributeError: 'NoneType' object has no attribute 'get_script_header'
为我修复它的解决方法:在列表install_requires中,我在“luigi”之前有“tornado”。通过将订单切换为“luigi”然后“龙卷风”,这个错误就消失了。我看到你没有使用龙卷风或luigi,但我想排序仍然是这个问题的原因,因为你可以通过运行你的安装命令两次解决问题。
附加说明:在找到此解决方法之前,我尝试升级到最新的setuptools(v 5.8)。它没有解决这个错误。
答案 1 :(得分:0)
我遇到了同样的问题,并通过更新setuptools
版本来修复,即:
pip install --upgrade setuptools