python - python 2.7 中 language_check 安装错误

标签 python python-2.7 pip easy-install

我尝试使用以下方法在 Python 2.7 中安装 language_check 库

pip install language_check

还有...

pip install language_check --upgrade

在这两种情况下,我都会收到以下错误...

Collecting language-check
Using cached language-check-0.8.tar.gz
Installing collected packages: language-check
  Running setup.py install for language-check
    Complete output from command "C:\Users\Gaurav M\Anaconda\python.exe" -c "import setuptools, tokenize;__file__='c:\\users\\gaurav~1\\appdata\\local\\temp\\pip-build-ew9qcy\\language-check\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\gaurav~1\appdata\local\temp\pip-b0zy9n-record\install-record.txt --single-version-externally-managed --compile:
    Downloading 'LanguageTool-3.2.zip' (87.3 MiB)...
    100%
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\gaurav~1\appdata\local\temp\pip-build-ew9qcy\language-check\setup.py", line 597, in <module>
        sys.exit(main())
      File "c:\users\gaurav~1\appdata\local\temp\pip-build-ew9qcy\language-check\setup.py", line 592, in main
        run_setup_hooks(config)
      File "c:\users\gaurav~1\appdata\local\temp\pip-build-ew9qcy\language-check\setup.py", line 561, in run_setup_hooks
        language_tool_hook(config)
      File "c:\users\gaurav~1\appdata\local\temp\pip-build-ew9qcy\language-check\setup.py", line 586, in language_tool_hook
        download_lt()
      File "download_lt.py", line 158, in download_lt
        os.path.join(PACKAGE_PATH, dirname))
    WindowsError: [Error 5] Access is denied

    ----------------------------------------
Command ""C:\Users\Gaurav M\Anaconda\python.exe" -c "import setuptools, tokenize;__file__='c:\\users\\gaurav~1\\appdata\\local\\temp\\pip-build-ew9qcy\\language-check\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\gaurav~1\appdata\local\temp\pip-b0zy9n-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\gaurav~1\appdata\local\temp\pip-build-ew9qcy\language-check

我也尝试过...

easy_install language_check

这会引发不同的错误...

Downloading https://pypi.python.org/packages/05/2e/471a9104b0fe7bb404de6d79e2fdd0c41ad08b87a16cbb4c8c5c9300a608/language-check-0.8.tar.gz#md5=8b4e3aa5e77bff1e33d3312a6dae870b
Processing language-check-0.8.tar.gz
Writing c:\users\gaurav~1\appdata\local\temp\easy_install-qkjgfj\language-check-0.8\setup.cfg
Running language-check-0.8\setup.py -q bdist_egg --dist-dir c:\users\gaurav~1\appdata\local\temp\easy_install-qkjgfj\language-check-0.8\egg-dist-tmp-py6mda
Downloading 'LanguageTool-3.2.zip' (87.3 MiB)...
100%
error: [Error 145] The directory is not empty <built-in function rmdir> c:\users\gaurav~1\appdata\local\temp\easy_install-qkjgfj\language-check-0.8\language_check\LanguageTool-3.2\org\languagetool\rules\uk

在这种情况下如何安装 language_check?

最佳答案

我检查了文件的来源download_lt.py (github language_check)。 当您尝试移动文件夹 language_check/LanguageTool-X.Y 时,似乎会发生错误。使用命令 os.rename() 来自您的 TemporaryFile 到您的 Anaconda Lib 文件夹。

到目前为止,@Orions 是对的,这是一个权限问题。

首先,您应该检查您的文件夹权限:

  • 转到您的本地文件夹(应为 C:\Users\Gaurav M\AppData\Local)
  • 右键单击 Temp选择 properties 上的文件夹
  • 转到Security选项卡和 EditAdd如果您的名字没有出现在 Group or user names 下,请输入您的名字.

对 Anaconda 文件夹重复该操作。 (应该是 C:\Users\Gaurav M\Anaconda)

其次,您可以尝试:

pip install --user language_check

但是 pip --user选项仅为用户安装软件包。

Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%Python on Windows. (See the Python documentation for site.USER_BASE for full details.)

最后但并非最不重要的一 pip 是, 我猜你正在使用 cmdpowershell作为命令行解释器。 在我看来,使用 cygwin在 Windows 上,很多事情变得更容易。虽然配置起来可能很痛苦,但我建议预先配置 cygwin解决方案如 Babun .

祝你好运!

关于python - python 2.7 中 language_check 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38773841/

相关文章:

python - ModuleNotFoundError : No module named 'pymysql' in jupyter

css - 为什么这个 XML 选择器不能从我试图抓取的网站中获取正确的数据?

linux - GCC在centos上安装pyICU报错

python - Homebrew、PIP、easy_install 等如何工作,以便我可以清理

python - 分隔字符串的最佳 ASCII 字符是什么?

python - 类变量与。 python中用于int值的实例变量

python - 在 Django 的过滤器查询中使用 lambda

python - 使用 libclang 进行函数边界识别

python - 如何在与另一个文件相同的窗口中显示OpenCV摄像机流?

python - 如何将图像添加到我的博客文章中?