在 Ubuntu 20 LTS 系统(Ubuntu 20.04.1 LTS)上,刚从 18.04 LTS 升级并运行 Pycharm 2020.2.3 professional(自升级 Ubuntu 以来通过 snap 重新安装了几次)。
检查是否已安装 distutils:
sudo apt-get reinstall python3-distutils
给出以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 1 to reinstall, 0 to remove and 11 not to upgrade.
Need to get 0 B/141 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 397429 files and directories currently installed.)
Preparing to unpack .../python3-distutils_3.8.5-1~20.04.1_all.deb ...
Unpacking python3-distutils (3.8.5-1~20.04.1) over (3.8.5-1~20.04.1) ...
Setting up python3-distutils (3.8.5-1~20.04.1) ...
在 bash 命令行中:
pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
在pycharm中,创建新项目执行以下命令:
/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip 安装 --no-index /snap/pycharm-professional/218/plugins/python/helpers/setuptools-44.1.1-py2.py3-none-any.whl
失败了,表明它“无法创建解释器”,并给出以下输出...
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 "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/__main__.py", line 23, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/main.py", line 10, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 9, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/main_parser.py", line 7, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/cmdoptions.py", line 19, in <module>
ModuleNotFoundError: No module named 'distutils.util'
我也尝试使用卸载
sudo snap 删除 pycharm-professional
然后使用工具箱重新安装——我遇到了同样的错误。
如何让 Pycharm 开始使用已安装的 distutils 版本或其自己的版本,以便我可以重新使用此 IDE 进行开发?或者 Pycharm 不能与 Ubuntu 20 LTS 配合使用?
感谢您的帮助