windows python3 安装 pycrypto 库遇到麻烦, 是不是要安装 vs? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
raiz

windows python3 安装 pycrypto 库遇到麻烦, 是不是要安装 vs?

  •  
  •   raiz Oct 4, 2015 5579 views
    This topic created in 3858 days ago, the information mentioned may be changed or developed.

    xxx\pycrypto-2.6.1>python34 setup.py build
    running build
    running build_py
    running build_ext
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Random.OSRNG.winrandom' extension
    Traceback (most recent call last):
    File "setup.py", line 456, in <module>
    core.setup(**kw)
    File "C:\Python34\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
    File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
    File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
    File "C:\Python34\lib\distutils\command\build.py", line 126, in run
    self.run_command(cmd_name)
    File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
    File "setup.py", line 253, in run
    build_ext.run(self)
    File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
    File "setup.py", line 150, in build_extensions
    build_ext.build_extensions(self)
    File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
    self.build_extension(ext)
    File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
    depends=ext.depends)
    File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
    self.initialize()
    File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
    File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
    raise ValueError(str(list(result.keys())))
    ValueError: ['path']

    11 replies    2015-10-05 08:58:01 +08:00
    FrankFang128
        1
    FrankFang128  
       Oct 4, 2015 via Android
    装个 Ubuntu
    zhuangzhuang1988
        2
    zhuangzhuang1988  
       Oct 4, 2015
    vs 有个专门的针对 python 的编译器
    geeklian
        3
    geeklian  
       Oct 4, 2015
    1 楼简直呵呵了...v2er 现在就这水准了?

    方法 1 :按个 Visual Studio 2010 ,以后就继续 pip 。

    方法 2 :使用 anaconda3.4 代替原版的 python3.4 , anaconda 是一个 cpython 的打包发行版,优点 NumPy\pycrypto 这种很难装的 pkg 都非常简单的安装。

    方法 3 :打开 http://www.voidspace.org.uk/python/pycrypto-2.6.1/,下载 pycrypto-2.6.1.win-amd64-py3.4.msi 。就单个包来说...收藏 2 个网址

    http://www.lfd.uci.edu/~gohlke/pythonlibs/
    http://www.voidspace.org.uk/python/modules.shtml
    RAKE
        4
    RAKE  
       Oct 4, 2015
    没记错那个 VS For Python 下载链接是 http://aka.ms/vspython

    的确有种 Python 在 Linux 下的支持更好的错觉了。蛮多 Python 开发的个人小应用到 Windows 就水土不服。尤其是中文支持!
    geeklian
        5
    geeklian  
       Oct 4, 2015
    @RAKE


    Python version VC++ version
    2.5.6 7.1
    2.6.9 9.0
    2.7.6 9.0
    3.2.3 9.0
    3.3.5 10.0
    3.4.0 10.0

    9.0 = 2008
    10.0 = 2010

    3.5.0 要用 Visual Studio Community 2015 编译...

    python 的情况比微软想的还复杂... 233...

    微软给的 Microsoft Visual C++ Compiler for Python 2.7 ,这货其实是 vc2008 的编译环境,最好不要用在 python3.4 上

    但扯到各种第三方库的代码在不同版本的 vc 下不一定都能编译过去...

    所以最好的办法,还是下载现成的编译打包版本
    raiz
        6
    raiz  
    OP
       Oct 4, 2015
    @geeklian 谢谢 我用方法 3 直接安装了二进制
    raiz
        7
    raiz  
    OP
       Oct 4, 2015
    @geeklian 谢谢 好详细 python 在 windows 下 真蛋疼
    asahi
        8
    asahi  
       Oct 4, 2015
    这个问题我也遇到过,后来直接安了二进制包。 stackoverflow 上有一个回答能完整解决问题,需要安装 vs2010 还有一些补丁包,有些麻烦,但安装好就一劳永逸了。
    RAKE
        9
    RAKE  
       Oct 4, 2015
    @geeklian 果然我记错了, http://aka.ms/vcpython27 的确是 2.7 的 pip 弹出来的。
    还有比较想知道为何少部分库要自行编译, ruby 也是。
    raiz
        10
    raiz  
    OP
       Oct 4, 2015
    @RAKE 也想问, 版本很多很乱
    QQ1685425675
        11
    QQ1685425675  
       Oct 5, 2015
    有时候 安装一个 mingw32 也行的 加入系统变量
    About     Help     Advertise     Blog     API     FAQ     Solana     972 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 185ms UTC 20:35 PVG 04:35 LAX 13:35 JFK 16:35
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86