【问题标题】:Python easy_install throws chmod-errorPython easy_install 抛出 chmod-error
【发布时间】:2012-02-06 09:07:40
【问题描述】:

我正在尝试使用来自Getting Python and Fabric Installed on Windows 的指南在 Windows 7 上安装 Python Fabric。

为了安装 PyCrypto 和 Fabric,我按照指南中的建议使用了 easy_install,但都失败了,返回一个 chmod 错误:

Using c:\python27\lib\site-packages\fabric-1.3.4-py2.7.egg  
Processing dependencies for fabric  
Searching for pycrypto>=2.1,!=2.4  
Reading http://pypi.python.org/simple/pycrypto/  
Reading http://pycrypto.sourceforge.net  
Reading http://www.amk.ca/python/code/crypto  
Reading http://www.pycrypto.org/  
Best match: pycrypto 2.5  
Downloading http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.5.tar.gz  
Processing pycrypto-2.5.tar.gz  
Running pycrypto-2.5\setup.py -q bdist_egg --dist-dir   c:\users\birgit\appdata\local\temp\easy_install-nzrlow\pycrypto-2.5\egg-dist-tmp-_pwkm4  
The command "chmod" is spelled wrong or could not be found.

Traceback (most recent call last):
 File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module> load_entry_point('setuptools==0.6c12dev-r88846', 'console_scripts', 'easy_install')()  
 File "C:\Python27\lib\site-packages\setuptools-0.6c12dev_r88846-py2.7.egg\setuptools\command\easy_install.py", line 1712, in main  

 [... lots and lots of lines... (if they are relevant, I'll post them)]

 File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()  
 File "setup.py", line 269, in run  
RuntimeError: chmod error

我不太了解这个 chmod 的东西,但我认为 Windows 中没有 chmod?

我怎样才能让 easy_install 真正工作?

我发布了一个类似的问题here,在哪里(感谢@J.F. Sebastian)我找到了一种解决方法,可以在没有结构的情况下安装这些软件包。但现在我确实想知道,如何真正解决我在使用 easy_install 时遇到的问题。

【问题讨论】:

    标签: python windows chmod easy-install


    【解决方案1】:

    Download 并安装MinGW - Minimalist GNU for Windows

    要使某些 Unix 命令可以从 Windows 控制台访问,请在您的 env 变量中设置:

    C:\MinGW\bin;C:\MinGW\mingw32\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\msys\1.0\sbin
    

    .

    或者,从控制台:

    PATH=%PATH%;C:\MinGW\bin;C:\MinGW\mingw32\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\msys\1.0\sbin 
    

    【讨论】:

      【解决方案2】:

      以您机器的管理员身份登录。 chmod 指的是访问目录的权限,在这种情况下,我有一种感觉 python 在抱怨 Windows 7 的 UAC(用户帐户控制)。在C:\ 中创建目录需要在 Windows 中提升权限。

      【讨论】:

      • 谢谢! UAC 完成了这项工作!
      • 另外,对于遇到此问题的其他人,您可以按Shift + Enter 以管理员身份运行程序,而不是登录其他帐户。不过,您仍然需要密码。
      【解决方案3】:

      如果在第 269 行发生了明显的事情,您可以编辑脚本以删除有问题的行。

      如果没有,您可以安装所有依赖项,然后手动安装 Fabric。

      另外,考虑使用 virtualenv 和 pip。

      【讨论】:

      • 我想我想保持文件原样......特别是因为我不太了解python。
      【解决方案4】:

      我可以看到您使用的是 Python 2.x。因此,我会建议对我有用的方法。

      Here 下载 Pycrypto 安装程序。

      然后执行通常的步骤。选择要安装的 Lib/Site-packages,我有两个 Python 安装(Python 2 和 3,因此我选择了 Python 2/Lib/Site-packages)。

      走到最后。

      安装成功后,打开IDLE,输入:

      from Crypto.Hash import SHA256
      

      如果它没有任何错误,你就可以开始了。

      干杯。

      注意:我使用的是 Windows 8 机器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-31
        • 2015-08-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-10-13
        • 1970-01-01
        相关资源
        最近更新 更多