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

关于 pycharm 社区版,重命名被导入的模块名后的导入语句失效问题

  •  
  •   mingji · Dec 1, 2023 · 1713 views
    This topic created in 885 days ago, the information mentioned may be changed or developed.

    关于 pycharm 社区版,重命名被导入的模块名后的导入语句失效问题

    最近在用 pc 写代码,写了一些后,a.py 里面用导入了 settings.py, a.py 里前面几行原来是:

    import pygame
    from pygame.sprite import Group
    import center12_functions as gf
    from tree import Tree
    from center_ships import Ship
    from stats import Stats

    from settings import Settings

    我把原模块的名字 settings 和目的模块里的都改为 settings1 却发现"from settings1 import Settings"无法亮起,改回去也不行,现在一直都是灰色的,复制代码重建项目依然还是这个问题,请问这是什么原因,我还以为就是简单的更个名字,原来发现没那么简单.

    2 replies    2023-12-02 11:37:38 +08:00
    vituralfuture
        1
    vituralfuture  
       Dec 1, 2023 via Android
    没有高亮应该是未使用,如果无法导入的话显示为红色波浪线
    mingji
        2
    mingji  
    OP
       Dec 2, 2023
    @vituralfuture 谢谢,google 也没找到有效的信息,卸载了 PY 重新安装了一遍,然后测试修改被导入的模块名,发现还是有一样的问题,感觉像电脑里不支持热插拔一样/汗,不管这个软件问题了.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2876 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 07:35 · PVG 15:35 · LAX 00:35 · JFK 03:35
    ♥ Do have faith in what you're doing.