【问题标题】:Installation error for language_check in python 2.7python 2.7中language_check的安装错误
【发布时间】:2016-12-10 23:03:17
【问题描述】:

我尝试在 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?

【问题讨论】:

  • python -m pip install language_check stackoverflow source
  • 错误提示:WindowsError: [Error 5] Access is denied,那么您是否尝试以管理员(root)身份运行命令提示符?
  • @Orions 让我检查一下...但是我能够通过同一用户使用 pip 安装其他库...如果我没有管理员权限,我应该无法安装任何库对吗?
  • @Orions 确认我以管理员身份执行此操作。
  • @MaxChrétien python -m pip install 抛出同样的错误:(

标签: python python-2.7 pip easy-install


【解决方案1】:

我检查了文件download_lt.py (github language_check) 的来源。 当您尝试使用命令 os.rename() 将文件夹 language_check/LanguageTool-X.Y 从您的 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 选项仅为用户安装包。

安装到您平台的 Python 用户安装目录。通常是 ~/.local/,或 Windows 上的 %APPDATA%Python。 (有关详细信息,请参阅 site.USER_BASE 的 Python 文档。)

最后但同样重要的是, 我假设您正在使用cmdpowershell作为命令行解释器。 在我看来,在 Windows 上使用 cygwin 会使很多事情变得更容易。虽然配置起来可能会很痛苦,但我建议使用预配置 cygwin 解决方案,例如 Babun

祝你好运!

【讨论】:

  • 谢谢 Max...我检查了 temp 和 anaconda 的 Securtiy 选项卡...'Gaurav' 具有所有权限...它仍然显示相同的错误...我也能够安装所有其他软件包...它唯一的语言检查是个问题...我正在使用 cmd,但现在将尝试按照您的建议使用 cygwin...让我们看看它是怎么回事...
猜你喜欢
  • 1970-01-01
  • 2019-03-25
  • 2021-12-25
  • 2021-05-03
  • 2019-10-15
  • 1970-01-01
  • 1970-01-01
  • 2013-08-20
  • 2012-06-18
相关资源
最近更新 更多