2014-10-27 61 views
0

我试图通过pip install gmpy在使用的virtualenv创建了一个测试环境中安装gmpy安装错误,但它被踢回一个错误蟒蛇gmpy使用微软的Visual C++编译程序包的Python 2.7

我的笔记本电脑是一个Windows 8.1 x64使用Python 27 x32

我安装了用于Python 2.7的Microsoft Visual C++编译器包,因为我得到了unable to find vcvarsall.bat错误消息。有一次,我的Python 2.7安装在C++编译器套件和升级setuptools to 7.0该消息走了,但我得到如下:

c:\envs\testenv1\build\gmpy\src\gmpy.h(30) : fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory 

error: command 'C:\\Users\\user_name\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2 

---------------------------------------- 
Cleaning up... 
    Removing temporary dir C:\envs\testenv1\build... 
Command C:\envs\testenv1\Scripts\python.exe -c "import setuptools, tokenize;__file__='C:\\envs\\testenv1\\build\\gmpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user_name\appdata\local\temp\pip-t4r7jf-record\install-record.txt --single-version-externally-managed --compile --install-headers C:\envs\testenv1\include\site\python2.7 failed with error code 1 in C:\envs\testenv1\build\gmpy 
Exception information: 
Traceback (most recent call last): 
    File "C:\envs\testenv1\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "C:\envs\testenv1\lib\site-packages\pip\commands\install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "C:\envs\testenv1\lib\site-packages\pip\req.py", line 1435, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "C:\envs\testenv1\lib\site-packages\pip\req.py", line 706, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "C:\envs\testenv1\lib\site-packages\pip\util.py", line 697, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command C:\envs\testenv1\Scripts\python.exe -c "import setuptools, tokenize;__file__='C:\\envs\\testenv1\\build\\gmpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user_name\appdata\local\temp\pip-t4r7jf-record\install-record.txt --single-version-externally-managed --compile --install-headers C:\envs\testenv1\include\site\python2.7 failed with error code 1 in C:\envs\testenv1\build\gmpy 

可有人点我在正确的方向?

我有以下的安装:

Microsoft Visual 2008 Redistributable - x64 9.0.30729.6161 
Microsoft Visual 2008 Redistributable - x86 9.0.30729.6161 

Microsoft Visual 2010 x64 Redistributable - 10.0.40219 
Microsoft Visual 2010 x86 Redistributable - 10.0.40219 

Microsoft Visual 2012 Redistributable (x64) - 11.0.61030 
Microsoft Visual 2012 Redistributable (x86) - 11.0.61030 

Microsoft Visual C++ Compiler Package for Python 2.7 

我不想安装VS2008或MINGW。我希望“用于Python 2.7的Microsoft Visual C++编译器包”能纠正这个问题,但它没有。

回答

0

我维护gmpy,我只是说在Windows上构建gmpygmpy2是非常具有挑战性的。有没有理由不能使用预先构建的二进制文件? gmpy/gmpy2依赖于单个DLL,因此如果需要,可以很容易地将其复制到不同的位置。

+0

我原本想安装pycrypto。但是我收到了警告:没有找到GMP或MPIR库;不会在C++编译器错误的同时生成Crypto.PublickKey._fastmath错误。我想安装pysftp,它需要paramiko,它需要pycrypto,它需要gmp库。我觉得我这样做是错误的。我只是想用ssl建立ftp连接。我新来python。 – jes516 2014-10-27 03:13:03

+0

'PyCrypto'实际上并不需要'gmpy'。它需要GMP或MPIR'C'库。 'gmpy'也需要相同的库。编译GMP或MPIR是挑战。我会寻找预构建的PyCrypto的Windows二进制文件。 – casevh 2014-10-27 04:15:11

+0

你知不知道我是否需要'pycrypto'作为'paramiko'?根据文档,我知道pysftp的要求包括paramiko .. – jes516 2014-10-27 12:29:42