运行python设置时,py test,python setup.py构建,甚至python setup.py-help-commands,我得到了" oserror:[errno 2]没有这样的文件或此类文件或目录"。
到目前为止,我已经尝试了升级Setuptools(当前运行版本41.0.1(,但这还没有解决问题。
我的匿名设置。Py看起来像:
from setuptools import setup, find_packages
def read_version():
with open('version') as ver:
return ver.read().strip()
config = {
'description': 'package',
'author': 'Me',
'author_email': 'email@email.com',
'version': read_version(),
'packages': find_packages(),
'package_data': {
'manager.resources': ['*.yaml'],
},
'scripts': [],
'name': 'company.packagename',
'namespace_packages': ['company'],
'test_suite': 'tests',
'entry_points': {
'console_scripts': [
'launcher = manager_launcher:main',
'managerschemas = manager.validation:export',
'managertypes = manager.types:export',
]
},
'setup_requires': ['pytest-runner'],
'tests_require': [
'flake8',
'pylint',
'pytest',
'pytest-cov',
'pytest-mock',
],
}
if __name__ == '__main__':
setup(**config)
和setup.cfg是:
[aliases]
test = pytest
[flake8]
max-line-length = 120
exclude = venv,.eggs
[tool:pytest]
addopts = -vvvv --cov=manager --cov-branch --cov-fail-under=100 --cov-report=term --cov-report=html --junitxml=junit.xml
testpaths = tests
我得到的追溯是:
Traceback (most recent call last):
File "setup.py", line 40, in <module>
setup(**config)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/dist.py", line 717, in fetch_build_eggs
replace_conflicting=True,
File "/home/vagrant/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/home/vagrant/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/home/vagrant/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/dist.py", line 784, in fetch_build_egg
return cmd.easy_install(req)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 855, in install_eggs
return [self.install_wheel(dist_filename, tmpdir)]
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1073, in install_wheel
os.path.dirname(destination)
File "/usr/lib/python2.7/distutils/cmd.py", line 349, in execute
util.execute(func, args, msg, dry_run=self.dry_run)
File "/usr/lib/python2.7/distutils/util.py", line 309, in execute
func(*args)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/wheel.py", line 101, in install_as_egg
self._install_as_egg(destination_eggdir, zf)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/wheel.py", line 109, in _install_as_egg
self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
File "/home/vagrant/.local/lib/python2.7/site-packages/setuptools/wheel.py", line 157, in _convert_metadata
os.path.join(egg_info, 'PKG-INFO'),
OSError: [Errno 2] No such file or directory
,因此事实证明,这个问题是由vagrant/virtualbox的同步文件夹中的滞后引起的。我试图使用同步文件夹在从主机文件系统共享的流量VM中构建Python项目。将项目从同步文件夹中复制到VM中的另一个文件夹中可以构建。另一个肮脏的骇客是增加时间。这为文件系统提供了同步的机会,因此可以解决该问题。