问题
$sbj. 可能与https://github.com/pypa/virtualenv/issues/1670有关
特别是在 Python 2 下可重现,似乎不会影响 py3。
再现
setup.cfg
$ cat setup.cfg
[metadata]
name = boom
version = attr: boom.versiontools.get_self_version
2.
python2 -m pip install 'virtualenv >= 20'
python2 -m virtualenv test-venv-py2
test-venv-py2/bin/pip install setuptools
(不一定是 setuptools,可以是 pip、6、任何东西,但必须存在于 PyPI 上)
import boom.versiontools.get_self_version
:$ test-venv-py2/bin/pip install setuptools
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: setuptools in ~/src/github/experiments/boom/test-venv-py2/lib/python2.7/site-packages (44.0.0)
ERROR: Exception:
Traceback (most recent call last):
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 412, in run
isolated=options.isolated_mode,
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 543, in get_lib_location_guesses
scheme = distutils_scheme('', *args, **kwargs)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/locations.py", line 109, in distutils_scheme
d.parse_config_files()
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site.py", line 153, in parse_config_files
result = old_parse_config_files(self, *args, **kwargs)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site.py", line 153, in parse_config_files
result = old_parse_config_files(self, *args, **kwargs)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.py", line 19, in parse_config_files
result = old_parse_config_files(self, *args, **kwargs)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/dist.py", line 702, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 121, in parse_configuration
meta.parse()
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 426, in parse
section_parser_method(section_options)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 399, in parse_section
self[name] = value
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 184, in __setitem__
value = parser(value)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 515, in _parse_version
version = self._parse_attr(value, self.package_dir)
File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 349, in _parse_attr
module = import_module(module_name)
File "~/.pyenv/versions/2.7.15/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named boom.versiontools
环境
centos:7
docker 容器下重现)pip list
安装了virtualenv
的宿主 python:
$ python2 -m pip list
Package Version
------------------- -----------
appdirs 1.4.3
configparser 4.0.2
contextlib2 0.6.0.post1
distlib 0.3.0
filelock 3.0.12
importlib-metadata 1.5.0
importlib-resources 1.1.0
pathlib2 2.3.5
pip 18.1
scandir 1.10.0
setuptools 40.5.0
singledispatch 3.4.0.3
six 1.14.0
typing 3.7.4.1
virtualenv 20.0.7
wheel 0.32.2
zipp 1.2.0
You are using pip version 18.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
虚拟环境创建的输出
确保使用-vvv --with-traceback
运行创建:
$ <kbd i="24">python2 -m virtualenv -vvv --with-traceback test-venv-py2</kbd>
58 setup logging to NOTSET [DEBUG report:43]
69 find interpreter for spec PythonSpec(path=~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2) [INFO builtin:44]
69 discover exe for PythonInfo(spec=CPython2.7.15.final.0-64, exe=~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2, platform=linux2, version=u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', encoding_fs_io=UTF-8-UTF-8) in ~/.pyenv/versions/2.7.15 [DEBUG py_info:340]
70 filesystem is case-sensitive [DEBUG info:28]
71 Attempting to acquire lock 139774354598416 on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [DEBUG filelock:270]
72 Lock 139774354598416 acquired on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [INFO filelock:274]
72 get PythonInfo from ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.json for ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG cached_py_info:76]
73 Attempting to release lock 139774354598416 on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [DEBUG filelock:315]
73 Lock 139774354598416 released on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [INFO filelock:318]
73 proposed PythonInfo({u'base_exec_prefix': None, u'system_stdlib': u'~/.pyenv/versions/2.7.15/lib/python2.7', u'has_venv': False, u'prefix': u'~/.pyenv/versions/2.7.15', u'stdout_encoding': None, u'executable': '~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2', u'implementation': u'CPython', u'exec_prefix': u'~/.pyenv/versions/2.7.15', u'platform': u'linux2', u'version': u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', u'sysconfig_paths': {u'platstdlib': u'{platbase}/lib/python{py_version_short}', u'platlib': u'{platbase}/lib/python{py_version_short}/site-packages', u'purelib': u'{base}/lib/python{py_version_short}/site-packages', u'stdlib': u'{base}/lib/python{py_version_short}', u'scripts': u'{base}/bin', u'include': u'{base}/include/python{py_version_short}', u'data': u'{base}'}, u'base_prefix': None, u'file_system_encoding': u'UTF-8', u'version_info': VersionInfo(major=2, minor=7, micro=15, releaselevel=u'final', serial=0), u'sysconfig_vars': {u'base': u'~/.pyenv/versions/2.7.15', u'platbase': u'~/.pyenv/versions/2.7.15', u'PYTHONFRAMEWORK': u'', u'py_version_short': u'2.7'}, u'path': [u'~/.pyenv/versions/2.7.15/envs/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/discovery', u'~/.pyenv/versions/2.7.15/lib/python27.zip', u'~/.pyenv/versions/2.7.15/lib/python2.7', u'~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-old', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload', u'~/.pyenv/versions/2.7.15/lib/python2.7/site-packages'], u'max_size': 9223372036854775807, u'real_prefix': None, u'distutils_install': {u'purelib': u'lib/python2.7/site-packages', u'headers': u'include/python2.7/UNKNOWN', u'platlib': u'lib/python2.7/site-packages', u'data': u'', u'scripts': u'bin'}, u'architecture': 64, u'original_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7', u'os': u'posix', u'system_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7'}) [INFO builtin:50]
74 accepted PythonInfo({u'base_exec_prefix': None, u'system_stdlib': u'~/.pyenv/versions/2.7.15/lib/python2.7', u'has_venv': False, u'prefix': u'~/.pyenv/versions/2.7.15', u'stdout_encoding': None, u'executable': '~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2', u'implementation': u'CPython', u'exec_prefix': u'~/.pyenv/versions/2.7.15', u'platform': u'linux2', u'version': u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', u'sysconfig_paths': {u'platstdlib': u'{platbase}/lib/python{py_version_short}', u'platlib': u'{platbase}/lib/python{py_version_short}/site-packages', u'purelib': u'{base}/lib/python{py_version_short}/site-packages', u'stdlib': u'{base}/lib/python{py_version_short}', u'scripts': u'{base}/bin', u'include': u'{base}/include/python{py_version_short}', u'data': u'{base}'}, u'base_prefix': None, u'file_system_encoding': u'UTF-8', u'version_info': VersionInfo(major=2, minor=7, micro=15, releaselevel=u'final', serial=0), u'sysconfig_vars': {u'base': u'~/.pyenv/versions/2.7.15', u'platbase': u'~/.pyenv/versions/2.7.15', u'PYTHONFRAMEWORK': u'', u'py_version_short': u'2.7'}, u'path': [u'~/.pyenv/versions/2.7.15/envs/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/discovery', u'~/.pyenv/versions/2.7.15/lib/python27.zip', u'~/.pyenv/versions/2.7.15/lib/python2.7', u'~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-old', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload', u'~/.pyenv/versions/2.7.15/lib/python2.7/site-packages'], u'max_size': 9223372036854775807, u'real_prefix': None, u'distutils_install': {u'purelib': u'lib/python2.7/site-packages', u'headers': u'include/python2.7/UNKNOWN', u'platlib': u'lib/python2.7/site-packages', u'data': u'', u'scripts': u'bin'}, u'architecture': 64, u'original_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7', u'os': u'posix', u'system_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7'}) [DEBUG builtin:52]
107 create virtual environment via CPython2Posix(dest=~/src/github/ansible/ansible-lint/test-venv-py2, clear=False, global=False) [INFO session:52]
107 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/bin [DEBUG _sync:21]
108 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/include [DEBUG _sync:21]
108 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages [DEBUG _sync:21]
108 write ~/src/github/ansible/ansible-lint/test-venv-py2/pyvenv.cfg [DEBUG pyenv_cfg:34]
108 home = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 implementation = CPython [DEBUG pyenv_cfg:38]
108 version_info = 2.7.15.final.0 [DEBUG pyenv_cfg:38]
108 virtualenv = 20.0.7 [DEBUG pyenv_cfg:38]
108 include-system-site-packages = false [DEBUG pyenv_cfg:38]
108 base-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 base-exec-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 base-executable = ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG pyenv_cfg:38]
108 copy ~/.pyenv/versions/2.7.15/bin/python2.7 to ~/src/github/ansible/ansible-lint/test-venv-py2/bin/python [DEBUG _sync:48]
114 symlink ~/.pyenv/versions/2.7.15/lib/python2.7/os.py to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/os.py [DEBUG _sync:40]
115 symlink ~/.pyenv/versions/2.7.15/lib/python2.7/os.pyc to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/os.pyc [DEBUG _sync:40]
115 symlink directory ~/.pyenv/versions/2.7.15/include/python2.7 to ~/src/github/ansible/ansible-lint/test-venv-py2/include/python2.7 [DEBUG _sync:40]
115 symlink directory ~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/lib-dynload [DEBUG _sync:40]
115 add distutils patch file ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.py [DEBUG api:63]
116 add distutils patch file ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.pth [DEBUG api:67]
116 ============================== target debug ============================== [DEBUG session:54]
117 debug via ~/src/github/ansible/ansible-lint/test-venv-py2/bin/python ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/create/debug.py [DEBUG creator:182]
116 {
"site": "<module 'site' from '~/.pyenv/versions/2.7.15/lib/python2.7/site.pyc'>",
"datetime": "<module 'datetime' from '~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload/datetime.so'>",
"sys": {
"executable": "~/src/github/ansible/ansible-lint/test-venv-py2/bin/python",
"real_prefix": "~/.pyenv/versions/2.7.15",
"base_exec_prefix": "~/.pyenv/versions/2.7.15",
"exec_prefix": "~/src/github/ansible/ansible-lint/test-venv-py2",
"io_encoding": null,
"meta_path": [],
"fs_encoding": "UTF-8",
"prefix": "~/src/github/ansible/ansible-lint/test-venv-py2",
"_base_executable": null,
"path": [
"~/.pyenv/versions/2.7.15/lib/python27.zip",
"~/.pyenv/versions/2.7.15/lib/python2.7",
"~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2",
"~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk",
"~/.pyenv/versions/2.7.15/lib/python2.7/lib-old",
"~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload",
"~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages"
],
"base_prefix": "~/.pyenv/versions/2.7.15"
},
"json": "<module 'json' from '~/.pyenv/versions/2.7.15/lib/python2.7/json/__init__.pyc'>",
"version": "2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]",
"os": "<module 'os' from '~/.pyenv/versions/2.7.15/lib/python2.7/os.pyc'>",
"math": "<module 'math' from '~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload/math.so'>"
} [DEBUG session:55]
146 add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=~/.local/share/virtualenv/seed-app-data/v1) [INFO session:59]
146 Attempting to acquire lock 139774343684496 on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [DEBUG filelock:270]
146 Lock 139774343684496 acquired on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [INFO filelock:274]
147 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/pip-20.0.2-py2.py3-none-any.whl [DEBUG acquire:51]
148 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/wheel-0.34.2-py2.py3-none-any.whl [DEBUG acquire:51]
148 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/setuptools-44.0.0-py2.py3-none-any.whl [DEBUG acquire:51]
150 install wheel from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
150 install pip from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/pip-20.0.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
151 install setuptools from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/setuptools-44.0.0-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
151 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel [DEBUG _sync:48]
151 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip [DEBUG _sync:48]
152 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/easy_install.py to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/easy_install.py [DEBUG _sync:48]
152 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/pkg_resources to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pkg_resources [DEBUG _sync:48]
156 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel-0.34.2.dist-info [DEBUG _sync:48]
158 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools [DEBUG _sync:48]
159 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel-0.34.2.virtualenv [DEBUG _sync:48]
160 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel to 755 [INFO util:566]
160 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel-2.7 to 755 [INFO util:566]
161 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel2 to 755 [INFO util:566]
161 generated console scripts wheel wheel2 wheel-2.7 [DEBUG base:53]
175 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools-44.0.0.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools-44.0.0.dist-info [DEBUG _sync:48]
177 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools-44.0.0.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools-44.0.0.virtualenv [DEBUG _sync:48]
178 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install to 755 [INFO util:566]
179 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install2 to 755 [INFO util:566]
179 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install-2.7 to 755 [INFO util:566]
180 generated console scripts easy_install easy_install2 easy_install-2.7 [DEBUG base:53]
219 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip-20.0.2.dist-info [DEBUG _sync:48]
221 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip-20.0.2.virtualenv [DEBUG _sync:48]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip to 755 [INFO util:566]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip-2.7 to 755 [INFO util:566]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip2 to 755 [INFO util:566]
222 generated console scripts pip pip-2.7 pip2 [DEBUG base:53]
223 Attempting to release lock 139774343684496 on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [DEBUG filelock:315]
223 Lock 139774343684496 released on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [INFO filelock:318]
223 add activators for Python, CShell, Fish, PowerShell, Bash [INFO session:65]
226 write ~/src/github/ansible/ansible-lint/test-venv-py2/pyvenv.cfg [DEBUG pyenv_cfg:34]
226 home = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
226 implementation = CPython [DEBUG pyenv_cfg:38]
226 version_info = 2.7.15.final.0 [DEBUG pyenv_cfg:38]
226 virtualenv = 20.0.7 [DEBUG pyenv_cfg:38]
226 include-system-site-packages = false [DEBUG pyenv_cfg:38]
226 base-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
227 base-exec-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
227 base-executable = ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG pyenv_cfg:38]
227 created virtual environment CPython2.7.15.final.0-64 in 170ms
creator CPython2Posix(dest=~/src/github/ansible/ansible-lint/test-venv-py2, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=~/.local/share/virtualenv/seed-app-data/v1)
activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator [WARNING __main__:21]
参考: https :
观察 ImportError 因为它从 CWD 加载配置,而 CWD 又尝试导入 bom.versiontools.get_self_version
这不是应该做的吗? 在您的期望中,这里会发生什么?
它不会尝试在 Python 3 / Python 2 + virtualenv 16 下导入东西。但在 Python 2 + virtualenv 20 下它会爆炸。
不,当您安装其他软件包时它不应该爆炸,因为您在 CWD 中有一些东西。
@webknjaz您是否 100% 不会在旧的 virtualenv 上导入? (也许它只是在 20+ 上失败了)——这是一个 setuptools 的内部实现细节
积极的。 它在 virtualenv 20+ 上失败,但仅与 Python 2 结合使用,这就是我要说的。
https://github.com/pypa/virtualenv/pull/1688可能会修复它,你能检查一下吗?
好的,我去查一下。
谢谢,今天将合并,并发布一个版本。
您好,已通过 virtualenv 20.0.8 发布了针对此问题的修复程序; 看到https://pypi.org/project/virtualenv/20.0.8/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-8-2020-03-04)。 如果您的问题没有得到解决,请尝试并报告; 如果没有,请在此处发表评论,我们将重新打开票证。 对于由此给您带来的不便,我们深表歉意,并感谢您在我们解决此新主要版本中出现的意外错误时的耐心等待。
感谢@gaborbernat提供响应式修复和隐身版本! 非常感谢您的工作!
最有用的评论
您好,已通过 virtualenv 20.0.8 发布了针对此问题的修复程序; 看到https://pypi.org/project/virtualenv/20.0.8/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-8-2020-03-04)。 如果您的问题没有得到解决,请尝试并报告; 如果没有,请在此处发表评论,我们将重新打开票证。 对于由此给您带来的不便,我们深表歉意,并感谢您在我们解决此新主要版本中出现的意外错误时的耐心等待。