我做了全新的Linux Mint 18.3安装。然后,安装Visual Studio Code和Python扩展,将python3设置为解释器。当打开具有.py文件扩展名的文件时,VSC建议安装pylint。选择" install"后,我在集成终端中获得以下内容:
sh-4.3$ "/usr/bin/python3" -m pip install -U pylint
Collecting pylint
Using cached pylint-1.8.1-py2.py3-none-any.whl
Collecting mccabe (from pylint)
Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint)
Using cached isort-4.2.15-py2.py3-none-any.whl
Collecting astroid<2.0 (from pylint)
Using cached astroid-1.6.0-py2.py3-none-any.whl
Collecting six (from pylint)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting wrapt (from astroid<2.0->pylint)
Using cached wrapt-1.10.11.tar.gz
Collecting lazy-object-proxy (from astroid<2.0->pylint)
Using cached lazy_object_proxy-1.3.1-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: mccabe, isort, six, wrapt, lazy-object-proxy, astroid, pylint
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/req/req_set.py", line 742, in install
**kwargs
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg/pip/wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python3.5/shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 30] Read-only file system: '/usr/lib/python3.5/site-packages/mccabe.py'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我试图将/usr/lib/python3.5/及其子目录的所有者更改为我,但这并没有帮助。
我该如何解决?非常感谢。
答案 0 :(得分:0)
您最好的选择是创建虚拟环境或使用用户安装。
对于虚拟环境,如果您在VS Code中打开的目录中创建它,则扩展程序将选择它并默认使用它。然后,您可以将Pylint安装到虚拟环境中。
或者,您可以使用/usr/bin/python3 install --user --upgrade pylint
全局安装Pylint。这会将它安装到python3
的Python版本的用户目录中。 (这将成为2018.1
版本中的默认功能。)