python - Visual Studio Code : OSError: [Errno 30] Read-only file system while trying to install pylint on Linux Mint

标签 python linux python-3.x visual-studio-code

我全新安装了 Linux Mint 18.3。之后,安装 Visual Studio Code 和 Python 扩展,将 python3 设置为解释器。打开文件扩展名为 .py 的文件时,VSC 会建议安装 pylint。选择“安装”后,我在集成终端中得到以下信息:

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/及其子目录的所有者更改为我,但这没有帮助。

我该如何解决?非常感谢。

最佳答案

您最好的选择是创建虚拟环境或使用用户安装。

对于虚拟环境,如果您在您在 VS Code 中打开的目录中创建它,那么扩展程序将默认选择并使用它。然后,您可以将 Pylint 安装到虚拟环境中。

或者,您可以使用 /usr/bin/python3 install --user --upgrade pylint 全局安装 Pylint。这会将它安装到 python3 所在的 Python 版本的用户目录中。 (这将成为 2018.1 版本中的默认功能。)

关于python - Visual Studio Code : OSError: [Errno 30] Read-only file system while trying to install pylint on Linux Mint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48390361/

相关文章:

python - python中的describe(包括 'top')中的='all'函数有什么用?

python - 基于python中的条件绘制多色线

python 使用 w 模式

python - 哪个 linux 工具最适契约(Contract)时解析多个文件

python - 澄清作者的意思(学习Python第五版)

Python 意外移动带有 os.rename 的文件

python - 作为默认函数参数的函数调用

python - 在 Python 中异步编写 CSV 文件

python - 无法使用 OS X El Capitan pip 安装任何东西

linux - 在单个 Linux 命令操作系统脚本中使用某些条件重命名多个文件夹中的所有文件。