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
louhang
V2EX  ›  Python

用 pip3 去安装第三方模块会提示找不到版本?

  •  
  •   louhang · 2018-12-10 15:49:54 +08:00 · 7406 次点击
    这是一个创建于 1935 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我用 pip3 去安装模块提示找不到版本,安装任何模块都是这个回答。 pip3 install requests

    Could not find a version that satisfies the requirement requests (from versions: ) No matching distribution found for requests

    pip3 install PyMySQL-0.9.2-py2.py3-none-any.whl

    Could not find a version that satisfies the requirement cryptography (from PyMySQL==0.9.2) (from versions: ) No matching distribution found for cryptography (from PyMySQL==0.9.2)

    又遇到这种问题的大佬吗?

    10 条回复    2018-12-13 08:25:41 +08:00
    holajamc
        1
    holajamc  
       2018-12-10 16:22:03 +08:00
    更新 setuptools 或者 pip 试试呗?
    careofzm
        2
    careofzm  
       2018-12-10 17:44:28 +08:00
    感觉是你的 pip 源的问题, 用阿里的源或者官方的源试试
    louhang
        3
    louhang  
    OP
       2018-12-10 17:50:18 +08:00
    我在 linux 的 python 文件夹中没有找到 Scripts 这个文件夹,和这个有关系吗?
    louhang
        4
    louhang  
    OP
       2018-12-10 17:50:38 +08:00
    @careofzm
    @holajamc
    我在 linux 的 python 文件夹中没有找到 Scripts 这个文件夹,和这个有关系吗?
    hsfzxjy
        5
    hsfzxjy  
       2018-12-10 18:08:56 +08:00 via Android
    @louhang linux 下本来就不会有这个目录,应该是源的问题
    careofzm
        6
    careofzm  
       2018-12-10 18:19:17 +08:00
    pip search cryptography, 你先搜搜有没有这个
    careofzm
        7
    careofzm  
       2018-12-10 18:34:43 +08:00
    两个建议, 一个是卸载重装 uninstall python3-pip, 另一个指定源-i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
    louhang
        8
    louhang  
    OP
       2018-12-10 18:41:00 +08:00
    @careofzm
    pip3 install requests -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
    Exception:
    Traceback (most recent call last):
    File "/usr/local/python3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
    File "/usr/local/python3/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
    File "/usr/local/python3/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
    File "/usr/local/python3/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
    File "/usr/local/python3/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
    File "/usr/local/python3/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
    File "/usr/local/python3/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
    File "/usr/local/python3/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
    File "/usr/local/python3/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
    PermissionError: [Errno 13] Permission denied: '/usr/local/python3/lib/python3.6/site-packages/urllib3'
    感觉也不是源的问题呀,这个 python 是运维给部的,我也没 root 权限,只是一个正常访问 linux 服务器的权限。
    careofzm
        9
    careofzm  
       2018-12-10 19:24:15 +08:00
    你创建个虚拟环境,virtualenv 这个包安装了吧,
    mkdir py3
    virtualenv py3 -p python3
    source py3/bin/active
    pip install requests
    用这个虚拟环境吧, 如果没有权限,或没有 virtuanlenv 运维装一个吧
    xueyoucai
        10
    xueyoucai  
       2018-12-13 08:25:41 +08:00
    换个源试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1273 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 177ms · UTC 17:49 · PVG 01:49 · LAX 10:49 · JFK 13:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.