Raspbian Buster默认具有Python3.7。我正在尝试制作一个Python3.6 virtualenv。我重新安装了带有桌面的Raspbian Buster(不是带有“推荐软件”的版本),并且已经安装sudo apt-get update; sudo apt-get upgrade
。
sudo apt-get install python3.6-dev
以获取Python 3.6。 pip3 install virtualenvwrapper
并将适当的行添加到我的.bashrc。mkvirtualenv --python=/usr/bin/python3.6 venv
时,出现以下错误Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/virtualenv.py", line 24, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
我已经搜索了答案,没有任何帮助。这是我所做的(据我所记得)。
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
添加到我的.bashrc中,但没有帮助。python3.6 -m pip install virtualenvwrapper
并收到另一个distutils错误:Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/usr/lib/python3/dist-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.locations import USER_CACHE_DIR, src_prefix
File "/usr/lib/python3/dist-packages/pip/_internal/locations.py", line 10, in <module>
from distutils import sysconfig as distutils_sysconfig
ImportError: cannot import name 'sysconfig'
mkvirtualenv venv
,但当然使用的是我不想要的Python 3.7。sudo apt-get install python3-distutils --reinstall
,但似乎只安装了Python3.7版本。没有python3.6-distutils
软件包。任何人都知道如何使它正常工作?
Raspbian Buster默认具有Python3.7。我正在尝试制作一个Python3.6 virtualenv。我重新安装了带有桌面的Raspbian Buster(不是带有“推荐软件”的版本)和...
我有相同的问题(ModuleNotFoundError: No module named 'distutils.spawn'
)。问题是我的系统上没有预安装python3的PIP。手动安装后,venv的创建没有问题: