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

请问 Python 的包是装在什么目录下

  •  
  •   saximi · Mar 21, 2018 · 5747 views
    This topic created in 2971 days ago, the information mentioned may be changed or developed.
    想从一台机器上安装好的 python 里把包拷贝出来到另外一台机器,请问包是默认装在 python 的什么路径下呢,感谢!
    10 replies    2018-03-28 19:49:54 +08:00
    pimin
        1
    pimin  
       Mar 21, 2018 via iPad   ❤️ 1
    1.为了避免各种乱七八糟的意外,这种情况建议使用 pyenv,从 A 机器整体搬到 B ;
    2.通常在%python 安装路径%\Lib\site-packages
    3. pip freeze > requirements.txt 了解下
    ksupertu
        2
    ksupertu  
       Mar 21, 2018
    补充楼上,到新机器安装:
    ```
    pip install -r requirements -i https://pypi.douban.com/simple
    ```
    使用豆瓣源加速,包管理也可以使用最新的 pipenv
    yonoho
        3
    yonoho  
       Mar 21, 2018
    进入 python 解释器,随便选一个目标包,import 进来看看就知道了,如:
    >>> import requests
    >>> requests
    <module 'requests' from '/xx/yy/lib/python/site-packages/requests'>
    scukmh
        4
    scukmh  
       Mar 22, 2018 via Android
    pip -V 了解一下?
    qwjhb
        5
    qwjhb  
       Mar 22, 2018
    如果像我一样要从联网机器搬到断网的机器
    pip download -r requirements.txt
    pip install --no-index --find-link /local/path/
    capljf
        6
    capljf  
       Mar 22, 2018
    pip show 包名
    Hopetree
        7
    Hopetree  
       Mar 22, 2018
    requirements.txt 才是王道
    mio101
        8
    mio101  
       Mar 22, 2018
    docker 了解一下
    cyspy
        9
    cyspy  
       Mar 22, 2018
    ArchLinux 的做法是:对于要使用的其他软件,用系统的 pacman 来管理,安装后与 pip 的 global 安装等价。这样,在删除了软件之后就可以顺便删掉 python 包。对于开发,直接用 venv
    saximi
        10
    saximi  
    OP
       Mar 28, 2018
    @qwjhb 请问如果两台机器都是断网状态, 其中一台装好了各种包,要如何才能迁移到另外一台机器上呢,机器间可以用 U 盘复制。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3050 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 09:19 · PVG 17:19 · LAX 02:19 · JFK 05:19
    ♥ Do have faith in what you're doing.