pycharm PYTHONPATH
Hi brandenju! I believe os.chdir doesn't affect PYTHONPATH so changing your working directory at runtime to resolve imports make little sense. One can edit PYTHONPATH with sys.path object if needed.
PyCharm refuse to read it
Could you please specify what exactly happened? Do you receive an unresolved reference error, ImportError during the runtime or both?
it's in my current directory
Is this directory a project root? If it's not then the problem seems to be clear - when running a file in the terminal your current working directory is added to the PYTHONPATH, this is not the case in PyCharm - by default, only the project root is added to PYTHONPATH. The basic workaround here is to mark lr_utils.py folder as Sources Root by right click in the Project window.
All source roots are added to PYTHONPATH.
pycharm PYTHONPATH的更多相关文章
- pycharm 的包路径设置export PYTHONPATH=$PYTHONPATH
我们使用pycharm的时候,经常会因为要链接(import)其他自己写的包,因此在pycharm的时候经常会 报错,就是找不到自己的包,在命令行下常用,export PYTHONPATH=$PYTH ...
- PyCharm 远程连接linux中Python 运行pyspark
PySpark in PyCharm on a remote server 1.确保remote端Python.spark安装正确 2.remote端安装.设置 vi /etc/profile添加一行 ...
- 利用PyCharm进行Python远程调试
背景描述 有时候Python应用的代码在本地开发环境运行十分正常,但是放到线上以后却出现了莫名其妙的异常,经过再三排查以后还是找不到问题原因,于是就在想,要是可以在服务器环境中进行单步跟踪调试就好了. ...
- windows下pycharm远程调试pyspark
参考http://www.mamicode.com/info-detail-1523356.html1.远端执行:vi /etc/profile添加一行:PYTHONPATH=$SPARK_HOME/ ...
- java&python环境变量+idea&pycharm激活
java: JAVA_HOME=C:\jdk1.5.0_06 PATH=%JAVA_HOME%\bin;%PATH% CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\l ...
- [转]pycharm常用快捷键及设置
PyCharm3.0默认快捷键(翻译的) PyCharm Default Keymap 1.编辑(Editing) Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + Alt ...
- Mac下面解决PYTHONPATH配置的方法
问题起因:MacPort安装的Python包在/opt目录里面,和系统安装的python包不在一起,由于Mac下面编译安装无止境的找不到问题,虽然MacPort解决了这个问题,但是它安装的东西,得自己 ...
- spark2.2.1安装、pycharm连接spark配置
一.单机版本Spark安装 Win10下安装Spark2.2.1 1. 工具准备 JDK 8u161 with NetBeans 8.2: http://www.oracle.com/technetw ...
- pycharm terminal 'import' 不是内部或外部命令,也不是可运行的程序
https://blog.csdn.net/jiangyanting2011/article/details/79065778 Python import同级目录报错 pycharm的py文件impo ...
随机推荐
- English trip -- VC(情景课)4 D
What do you see? I can see three men in the pictrue. one older man is a doctor, two younger men are ...
- English trip -- VC(情景课)3 A Family
xu言: 今天,老天很给面子.我在路上的时候基本上没有~然而我也没有带雨具.难道这就是传中的天道酬勤~或者说只要你努力,老天爷会给让路 Talk about the picture 看图说话 Look ...
- Rspec: everyday-rspec实操。FactoryBot预构件 (rspec-expectations gem 查看匹配器) 1-4章
总文档连接: RSpec.info/documentation/ 包括core, expectiation,rails , mock, 点击最新版本,然后右上角搜索class, method. 第3章 ...
- Android之SwipeRefreshLayout下拉刷新组件
SwipeRefreshLayout概述 SwipeRefrshLayout是Google官方更新的一个Widget,可以实现下拉刷新的效果.该控件集成自ViewGroup在support-v4兼容包 ...
- 『Sklearn』特征向量化处理
『Kaggle』分类任务_决策树&集成模型&DataFrame向量化操作 1 2 3 4 5 6 7 8 9 '''特征提取器''' from sklearn.feature_extr ...
- iOS UI-常用控件
#import "ViewController.h" @interface ViewController ()<UITextFieldDelegate> // 标题标签 ...
- PHP:第一章——按位运算和求余运算(判断奇偶数)
<?php //按位运算:与1按位运算等于0,输出偶数.如果等于1,输出奇数 //输出偶数: for($i=0;$i<10;$i++){ if(($i & 1)==0){ echo ...
- URAL 1934 最短路变形
DES:给出起点和终点.给出所有小岛的编号.所有路径的起始点.和遇到怪物的概率.要求在最短路的条件下维护遇见怪物的概率最小的路径.就是用 SPFA算法.每条路的权值设为1.最短路即为途径的岛数最少.同 ...
- POJ 2057 The Lost Home 树形dp 难度:2
The Lost House Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 2203 Accepted: 906 Des ...
- HDU 4635 Strongly connected (Tarjan+一点数学分析)
Strongly connected Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) ...