美文网首页
python pip 安装到了哪儿??

python pip 安装到了哪儿??

作者: bianruifeng | 来源:发表于2020-02-25 13:14 被阅读0次

    Python3.x版本及以上

    在实际使用Python做开发的时候,用pip安装管理依赖库是非常必要的。

    pip install mysql 或者 sudo pip install mysql (或者用pip3安装)

    其中mysql是安装的依赖库名或者包名。
    或者离线安装

    wget http://...selenium-3.141.0.tar.gz
    tar zvxf selenium-3.141.0.tar.gz
    cd selenium-3.141.0
    python setup.py build
    python setup.py install
    //如果python装了多版本,需要指定安装。pyhon3 setup.py build
    

    装了那么多第三方库到自己电脑,到底安装到了哪儿??

    第一步:先查看自己的默认安装路径到底是在哪?列出全局的packages包的安装路径在哪?

    打开cmd命令窗口,执行命令:python -m site

    输出:

    sys.path = [
        '/usr/local/lib',
        '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python37.zip',
        '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7',
        '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload',
        '/Users/username/Library/Python/3.7/lib/python/site-packages',
        '/usr/local/lib/python3.7/site-packages',
        '/usr/local/lib/python3.7/site-packages/selenium-3.141.0-py3.7.egg',
        '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages',
        '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium-3.141.0-py3.7.egg',
    ]
    USER_BASE: '/Users/username/Library/Python/3.7' (exists)
    USER_SITE: '/Users/username/Library/Python/3.7/lib/python/site-packages' (exists)
    ENABLE_USER_SITE: True
    
    

    site-packages 即为库安装的位置

    相关文章

      网友评论

          本文标题:python pip 安装到了哪儿??

          本文链接:https://www.haomeiwen.com/subject/ziozqhtx.html