python3.7虚拟环境创建在Debian 10中失败,并带有AttributeError

时间:2019-10-22 16:28:14

标签: python debian virtualenv python-3.7

我正在使用python3.4作为默认python版本的Debian 10 buster。

sridharrajs@debian:~/Desktop/repos/demo$ python3 --version
Python 3.4.2

对于我的一个新项目,我想使用python3.7

sridharrajs@debian:~/Desktop/repos/demo$ python3.7 --version
Python 3.7.3

创建虚拟环境时,它失败并显示AttributeError: module 'posix' has no attribute '__all__'

sridharrajs@debian:~/Desktop/repos/demo$ virtualenv -p python3.7 venv
Running virtualenv with interpreter /usr/local/bin/python3.7
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.7/os.py", line 42, in _get_exports_list
    return list(module.__all__)
AttributeError: module 'posix' has no attribute '__all__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site.py", line 79, in <module>
    import os
  File "/usr/lib/python3.7/os.py", line 65, in <module>
    __all__.extend(_get_exports_list(posix))
  File "/usr/lib/python3.7/os.py", line 44, in _get_exports_list
    return [n for n in dir(module) if n[0] != '_']
SystemError: <built-in function dir> returned NULL without setting an error

我尝试了Ubuntu 'Failed to import the site module' error messagePython 3 virtualenv problemsUsing Python 3 in virtualenv

0 个答案:

没有答案