ValueError: attempted relative import beyond top-level package
python 项目
在pycharm中, 在某个文件夹下: 右键--> mark directory as --> source root
如何在python脚本或者shell中 用代码实现 pycharm的文件夹
mark directory as source root的操作
Mark directory as source root 目的是修改程序的 PYTHONPATH,从而影响程序运行时的模块路径。这是 PyCharm 的行为,不清楚你要它干什么。要实现同样目的的话,从脚本里直接修改 sys.path 方便得多。
ValueError: attempted relative import beyond top-level package的更多相关文章
- ValueError: Attempted relative import in non-package
执行:python deom/scripts/populate.py ValueError: Attempted relative import in non-package solve:python ...
- Python ValueError: Attempted relative import in non-package Relative import相对引用 错误
包含相对路径import的python脚本不能直接运行,只能作为module被引用. 例如 from . import mod1 有这样代码的文件只能最为moulule为不能直接运行.相对路径就是相对 ...
- python引入pytesseract报错:ValueError: Attempted relative import in non-package
http://blog.csdn.net/yifengfuxue/article/details/79015651
- Python 相对导入attempted relative import beyond top-level package
ValueError: attempted relative import beyond top-level package 假设有如下层次包目录 project/ __init__.py mypac ...
- python:Attempted relative import in non-package
problem:Attempted relative import in non-package 所谓相对路径其实就是相对于当前module的路径,但如果直接执行脚本,这个module的name就是“ ...
- 执行代码出现ImportError:attempted relative import with no known parent package
前言 在这篇文章中,我将会解析 ImportError: attempted relative import with no known parent package 这个异常的原因.当你在运行的py ...
- Python工程:ImportError: attempted relative import with no known parent package
Python工程:ImportError: attempted relative import with no known parent package 解决方法: 1.对每个目录创建的时候都选择创建 ...
- python相对包导入报“Attempted relative import in non-package”错误
文章是从stackoverflow翻译过来的,原文地址:Relative imports for the billionth time 本文要在原理上解决 python当中相对包导入出现的问题. 问 ...
- Python导入自定义类时显示错误:attempted relative import beyond top-level package
显示这个错误可能有两个原因: 1.文件夹中没有包含__init__.py文件,该文件可以为空,但必须存在该文件. 2.把该文件当成主函数入口,该文件所在文件夹不能被解释器视作package,所以可能导 ...
随机推荐
- css的position属性
position: relative:保持未定位前的位置不变,若给了left,top的值,那么就会相对于原来的位置进行移动 absolute:元素原先在正常文档流中所占的空间会关闭,就好像元素原来不存 ...
- python3安装docx模块出现Import Error: No module named 'exceptions'
x首先 pip3 install docx 显示已经安装,但是 No module named 'exceptions' 网上查的资料命令行下载的docx安装包还没有完全兼容python3,第三方库应 ...
- 前端页面的适配使用rem换算
前端页面的适配使用rem换算 https://www.cnblogs.com/liangxuru/p/6970629.html 注:本文转载之处:https://www.cnblogs.com/ann ...
- day1 登录
#!/usr/bin/env python #Author:windtalker import os, getpass import sqlite3 from time import ctime pr ...
- eclipese的一些卡顿问题
一,在jsp页面上输入拼音的时候很卡顿怎么办? 二,我们在复制粘贴等用到ctry的时候会很卡顿,尤其是在jsp页面.干掉以下就好了.
- 关于node_js的比较
node_js的比较是我自己初学遇到的第一个绕脑的事情. 在比较的函数多了之后,一些函数的调用和变量提升, 搞得自己头晕,有时候函数是没有返回值的,自己还在 用变量值去比较,实际上却是undefine ...
- SQL Server2008R2循环语句
单循环语句 declare @i nvarchar(36) declare @LOCNUM nvarchar(36),@OBJECTTYPE nvarchar(36),@LOCDESC nvarcha ...
- centos6.5删除/boot后恢复
删除/boot下的所有东西 更改为从光盘启动并进入紧急救援模式 语言选择英语 选择美式键盘布局 不配置网络 选择Continue 这里提示系统已经被挂载到了/mnt/sysimage 选择shell, ...
- 随机函数rand()与srand()
一.int rand(void); 函数所在的头文件是stdlib.h: 其内部实现线性同除法,不是真正的随机数.通常rand()%x是指在x范围内取模,返回值0-x; 系统默认随机种子是1: 二.v ...
- tp5.0中使用PHPexcel,以及Loader的一些问题
在5.0中使用PHPexcel遇到一些问题,记录一下方便以后查看. 非使用PHPexcel的方法: 参考:http://blog.csdn.net/sinat_35861727/article/det ...