推荐学习书目
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
stonesirsir
V2EX  ›  Python

关于 Python 虚拟环境的问题

  •  
  •   stonesirsir · May 10, 2022 · 3181 views
    This topic created in 1466 days ago, the information mentioned may be changed or developed.

    创建 python 虚拟环境用的是 virtualenvwraper

    从 github 下载下来的源码,经常出现以下问题

    一级目录(audiobooks) 二级目录 app.py extensions.py

    app.py 中有一行 from audiobooks.extensions import cache, db, migrate

    然后报错 from audiobooks import extensions ModuleNotFoundError: No module named 'audiobooks'

    github 上的源码,我啥也没改啊,是跟虚拟环境有关系吗?现在程序都跑不起来

    求教

    8 replies    2022-05-11 10:35:08 +08:00
    billlee
        1
    billlee  
       May 10, 2022 via Android
    Github 源码为什么不直接贴地址呢,让我们猜谜?
    liuzy1999
        2
    liuzy1999  
       May 10, 2022
    无力吐槽...
    jZEdn7k4
        3
    jZEdn7k4  
       May 10, 2022
    前面加上:
    ```
    import sys
    sys.path.append("..")
    ```
    Bingchunmoli
        4
    Bingchunmoli  
       May 10, 2022
    可能 甚至还不会用包管理器。 虽然一直觉得 pip 挺拉的
    ipwx
        5
    ipwx  
       May 10, 2022   ❤️ 1
    python -m audiobooks.app

    不要直接运行 app.py

    详细的不解释了,自行去理解 Python 包和目录结构的关系
    flgn88
        6
    flgn88  
       May 10, 2022 via iPhone
    每个层级的目录里都加个空文件:__init__.py 试试。
    stonesirsir
        7
    stonesirsir  
    OP
       May 11, 2022
    谢谢各位兄弟了,就是没配置好的问题,小白一个,谢谢各位指教,5 楼方法正解
    ruanimal
        8
    ruanimal  
       May 11, 2022
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1642 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 81ms · UTC 16:29 · PVG 00:29 · LAX 09:29 · JFK 12:29
    ♥ Do have faith in what you're doing.