我尝试通过使用...在 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选项卡和Edit和Add你的名字,如果它没有出现在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.)
最后但同样重要的是, 我假设您正在使用 cmd或 powershell作为命令行解释器。 在我看来,使用 cygwin在 Windows 上使很多事情变得更容易。尽管配置起来可能很痛苦,但我还是推荐预配置 cygwin类似 Babun 的解决方案.
祝你好运!
