V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
chenguoyu
V2EX  ›  Python

为什么我用 pycharm 安装第三方库老是失败啊,也百度了很多,没找到啊

  •  
  •   chenguoyu · 2016-11-30 10:33:33 +08:00 · 63438 次点击
    这是一个创建于 2702 天前的主题,其中的信息可能已经有所发展或是发生改变。

    pip install --index-url http://pypi.doubanio.com/simple/ requests

    Non-zero exit code (1)

    Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Python\Python36\python.exe'.

    Collecting requests

    The repository located at pypi.doubanio.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pypi.doubanio.com'. Could not find a version that satisfies the requirement requests (from versions: ) No matching distribution found for requests

    26 条回复    2016-12-01 09:02:25 +08:00
    chenguoyu
        1
    chenguoyu  
    OP
       2016-11-30 10:34:26 +08:00
    把 http 改成 https 也没用啊
    gkiwi
        2
    gkiwi  
       2016-11-30 10:56:38 +08:00
    pip install requests --trusted-host pypi.doubanio.com 试试
    neoblackcap
        3
    neoblackcap  
       2016-11-30 11:00:42 +08:00   ❤️ 2
    换清华的源试试
    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
    q397064399
        4
    q397064399  
       2016-11-30 11:13:28 +08:00
    Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Python\Python36\python.exe'.

    好好把这段给鸡翻一下,你看是不是 pip 跟 python 版本不对应
    chenguoyu
        5
    chenguoyu  
    OP
       2016-11-30 11:16:01 +08:00
    @neoblackcap
    @gkiwi
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\cgy\AppData\Local\Temp\pip-build-wwuh4pnj\cffi\
    这是怎么回事呢?
    chenguoyu
        6
    chenguoyu  
    OP
       2016-11-30 11:17:40 +08:00
    @q397064399 我 pip 的版本是最新的 9.01 ,应该不会吧
    lrh3321
        7
    lrh3321  
       2016-11-30 11:19:31 +08:00
    windows 下安装库?

    你安装了 Microsoft Visual C++ Compiler for Python 2.7 或者 Microsoft Visual C++ Compiler for Python 3.4 了吗
    mansur
        8
    mansur  
       2016-11-30 11:22:44 +08:00
    LeGendAI
        9
    LeGendAI  
       2016-11-30 11:28:18 +08:00
    你是不是还装了 Python2.x 版,可能是用了 2.x 对应的 pip
    chenguoyu
        10
    chenguoyu  
    OP
       2016-11-30 11:28:59 +08:00
    @lrh3321 为什么我百度不到安装包呢?能不能给个链接
    chenguoyu
        11
    chenguoyu  
    OP
       2016-11-30 11:29:36 +08:00
    @LeGendAI 我已经卸载了,难道是没卸载干净?
    LeGendAI
        12
    LeGendAI  
       2016-11-30 11:46:17 +08:00
    @chenguoyu 你可以 pip -V 看看是不是 3.x 的版本
    lrh3321
        13
    lrh3321  
       2016-11-30 11:51:53 +08:00
    @chenguoyu https://www.microsoft.com/en-us/download/details.aspx?id=44266 2.7 的

    3.x 版本的话,我是直接装了 VS 2015. 你试试 Visual C++ Build Tools
    http://landinghub.visualstudio.com/visual-cpp-build-tools 有没有用吧
    chunk
        14
    chunk  
       2016-11-30 11:58:30 +08:00
    最近 pypi 源抽风
    SlipStupig
        15
    SlipStupig  
       2016-11-30 13:19:30 +08:00
    跟 VC 和 PIP 版本都没关系就是个参数问题, pip install --index-url http://pypi.doubanio.com/simple/ requests --trusted-host pypi.doubanio.com , 需要用这个参数“-trusted-host pypi.doubanio.com ”,否则为不信任源
    yunfengjiang
        16
    yunfengjiang  
       2016-11-30 13:24:38 +08:00
    命令后加上--trusted-host pypi.doubanio.com 这个参数 pip install --index-url http://pypi.doubanio.com/simple/ requests --trusted-host pypi.doubanio.com
    chenguoyu
        17
    chenguoyu  
    OP
       2016-11-30 14:10:58 +08:00
    @LeGendAI
    pip 9.0.1 from C:\Users\cgy\AppData\Roaming\Python\Python36\site-packages (python 3.6)
    没有问题呀
    chenguoyu
        18
    chenguoyu  
    OP
       2016-11-30 15:06:48 +08:00
    Command "c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\cgy\\AppData\\Local\\Temp\\pip-build-clugysos\\numpy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.rea
    d().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\cgy\AppData\Local\Temp\pip-_hf3fge5-record\install-record.txt --single-version-externally-managed --compile" fai
    led with error code 1 in C:\Users\cgy\AppData\Local\Temp\pip-build-clugysos\numpy\

    这是什么问题啊
    misaka19000
        19
    misaka19000  
       2016-11-30 15:43:24 +08:00
    给了管理员权限了吗
    chenguoyu
        20
    chenguoyu  
    OP
       2016-11-30 16:15:57 +08:00
    @misaka19000 给了,但是没用啊。而且一般是不用给管理员权限的吧
    chenguoyu
        21
    chenguoyu  
    OP
       2016-11-30 16:16:37 +08:00
    现在换成清华的镜像是可以的,可是报了个新的错
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
    好像是编译器的问题,但是还是无法解决
    xucuncicero
        22
    xucuncicero  
       2016-11-30 16:31:13 +08:00
    @chenguoyu set STATICBUILD=true && pip install XXX
    billgreen1
        23
    billgreen1  
       2016-11-30 16:55:46 +08:00 via iPhone
    Windows 上,编译会经常有问题。可以尝试使用 anaconda 或者,国外有个.edu 的网站,有已经编译好的
    ap010gi2e
        24
    ap010gi2e  
       2016-11-30 22:44:25 +08:00
    一般这个时候我会检查我的 pip 版本是不是最新版。我一般出现是在初始化 virtualenv 的时候,那时候 pip 的版本不是最新的,可试试。
    mingyun
        25
    mingyun  
       2016-12-01 00:08:12 +08:00
    python 在 windows 安装库很蛋疼
    8 楼比较靠谱,不过也不一定成功
    chenguoyu
        26
    chenguoyu  
    OP
       2016-12-01 09:02:25 +08:00
    @ap010gi2e
    @mingyun
    是最新的啊,我现在报 vs2014 目录下的 cl.exe 找不到 msdia140.dll ,可是明明有啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3100 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:10 · PVG 23:10 · LAX 08:10 · JFK 11:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.