我正在使用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 message,Python 3 virtualenv problems,Using Python 3 in virtualenv