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

windows 下用 powershell 和用 cmd 运行 Python 有什么区别吗

  •  
  •   IVeverKB · 2021-06-08 18:14:04 +08:00 · 2092 次点击
    这是一个创建于 1024 天前的主题,其中的信息可能已经有所发展或是发生改变。

    是这样的。在同一个 python 虚拟环境下(安装有 PyYAML 包),在 cmd 中 import yaml 一切正常,在 powershell 下 import yaml 就会提示 No module named 'yaml'

    请教一下是什么问题

    4 条回复    2021-06-08 19:07:07 +08:00
    AoEiuV020
        1
    AoEiuV020  
       2021-06-08 18:39:49 +08:00 via Android
    环境变量不同吧,
    IVeverKB
        2
    IVeverKB  
    OP
       2021-06-08 18:48:05 +08:00
    @AoEiuV020 #1
    关键其他包都没有问题的
    saucerman8
        3
    saucerman8  
       2021-06-08 18:49:28 +08:00
    ```
    >>> import sys
    >>> sys.path
    ```
    看看有没有差别
    IVeverKB
        4
    IVeverKB  
    OP
       2021-06-08 19:07:07 +08:00
    @saucerman8 #3
    谢谢具体指导。还真有些许的差异。之前偷懒虚拟环境直接从别的路径复制粘贴过来的,弄着弄着就乱了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1000 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 22:11 · PVG 06:11 · LAX 15:11 · JFK 18:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.