For the use of python Interactive window for , You can add a path to add a path to the python In recognizable path . The following code is used :

import sys

sys.path.append(' Paths to be added ')

You can then import “ Paths to be added " Medium python modular .


For paths that need to be added , stay windows In the system , The separator agrees to use double backslashes \\ express , as :C:\\Users\\Administrator\\source\\repos\\python-sklearn-regression-cookiecutter


It is particularly important to note that , except c: It's coming next \\ If you use \ replace , The system will prompt an error , If you use double slashes in other locations \ replace , So it's in execution sys.path.append(' Paths to be added ') Sentence time , No mistake , But it may not get a valid path , This leads to subsequent errors . such as :


After implementation , input sys.path The specific path is shown as :


Note that the red one is a single diagonal line , Instead of a double slash
, The other positions are automatically replaced by double oblique lines ( I don't know why ???), only source This one in the back \ Not replaced , It seems to be \r Caused by an escape symbol . And this path is not correct , The corresponding module in the path cannot be imported later .

therefore , Remember , When writing the path in the interactive window , Use both \\ To separate , Don't use it \ To separate .






©2020 ioDraw All rights reserved
Huawei Hongmeng system learning notes 9- Ecological construction of developers JavaScript Do a simple guess number games Centralized processing (mean centering) The myth and truth of JS Experimental summary of basic key knowledge ( whole ) Detailed explanation PHP Medium die,exit,returnPython Student information management system ( Lite )re Common methods of modules stata Basic operation of linear regression analysis flutter study -- Search box Docker Import of containers and mirrors , export