首页 > 其他分享 >ImportError: No module named argparse

ImportError: No module named argparse

时间:2023-11-06 15:31:52浏览次数:53  
标签:argparse named ImportError py module python Python 3.2

如果有root权限,可以运行:

easy_install argparse

 

如果没有root权限,As a simple solution copy argparse.py from https://code.google.com/p/argparse/source/browse/argparse.py to your project folder.

 

REF:

https://pypi.python.org/pypi/argparse

https://code.google.com/p/argparse/source/browse/argparse.py

http://stackoverflow.com/questions/21359400/python-2-6-importerror-no-module-named-argparse

 

As of Python >= 2.7 and >= 3.2, the argparse module is maintained within the Python standard library. For users who still need to support Python < 2.7 or < 3.2, it is also provided as a separate package, which tries to stay compatible with the module in the standard library, but also supports older Python versions.

argparse is licensed under the Python license, for details see LICENSE.txt.

Compatibility

argparse should work on Python >= 2.3, it was tested on:

  • 2.3, 2.4, 2.5, 2.6 and 2.7
  • 3.1, 3.2, 3.3, 3.4

Installation

Try one of these:

python setup.py install

easy_install argparse

pip install argparse

putting argparse.py in some directory listed in sys.path should also work



标签:argparse,named,ImportError,py,module,python,Python,3.2
From: https://blog.51cto.com/emanlee/8213087

相关文章

  • linux CentOS ModuleNotFoundError: No module named '_ctypes
    Yesthatworkedforme,ImadesurethesepackagesareinstalledonmyCentos7:sudoyuminstall-yzlib-develbzip2-developenssl-develncurses-develsqlite-develreadline-develtk-develgdbm-develdb4-devellibpcap-develxz-develexpat-devellibffi-dev......
  • argparse
    简介argparse是Python标准库中的一个用于处理命令行参数和选项的库。它提供了强大的命令行解析功能,可以帮助你轻松地创建命令行界面,解析用户提供的参数,并生成自动化的帮助文档。argparse的目标是让开发者能够创建用户友好的命令行工具,同时提供良好的错误处理机制。使用步骤......
  • Python:报错——ModuleNotFoundError: No module named 'encodings'
    运行Python报错:FatalPythonerror:Py_Initialize:unabletoloadthefilesystemcodecModuleNotFoundError:Nomodulenamed'encodings' 处理步骤:1.Files>>>Setting>>>Project>>>PythonInterpreter >>>AddInterpret......
  • spring注入bean错误-Bean named 'abc' is expected to be of type 'AAA' but was actu
    先看如下两个注入到spring容器中的bean,一个是UserNewManager,一个是UserManager。@ServicepublicclassUserNewManager{publicvoiddoSomething(){}}@ServicepublicclassUserManager{...}再看下面的testcase,利用@Resource注解来注入bean。@SpringB......
  • 解决Python报错ImportError: No module named ‘xxxx‘问题
    BASE_DIR=os.path.dirname(os.getcwd())#用来从jupyter默认地址中脱离出来importsyssys.path.append(BASE_DIR)sys.path.append('E:\CV_Paper_fuxian\lesson\B_VGG')#把文件所在的相对路径要添加进去。才不会报错然后运行,就完美解决了。......
  • 剔除以"Unnamed"开头的元素
    你可以使用Pandas的filter函数来剔除以"Unnamed"开头的元素。这是一个示例代码:importpandasaspd#假设df是你的DataFramedf=pd.DataFrame(columns=['序号','流程','Unnamed:2','项目','Unnamed:4','Unnamed:5','作业细节......
  • ModuleNotFoundError: No module named 'conda.auxlib'
    [~/software]$condaTraceback(mostrecentcalllast): File"/ppp/software/Anaconda3.8/bin/conda",line15,in<module>   sys.exit(main()) File"/ppp/software/Anaconda3.8/lib/python3.8/site-packages/conda/cli/main.py",line11......
  • ImportError: cannot import name 'parse_xml' from 'docx.oxml'
    问题解决:查看每一个报错的文件,比如__init__.py, composer.py找到报错的这一行,比如:fromdocx.oxmlimportparse_xml替换为:fromdocx.oxml.parserimportparse_xml注意:可能有多个文件出现这个问题,需要逐一解决!......
  • ModuleNotFoundError: No module named ‘xxx‘可能的解决方案大全
    "ModuleNotFoundError:Nomodulenamed'xxx'"这个报错是个非常常见的报错,几乎每个python程序员都遇到过,导致这个报错的原因也非常多,下面是我曾经遇到过的原因和解决方案module包没安装忘了import没有__init__.py文件package包的版本不对自定义的包名与安装的包名相同,导致i......
  • Java 21 新特性:Unnamed Patterns and Variables
    Java21中除了推出JEP445:UnnamedClassesandInstanceMainMethods之外,还有另外一个预览功能:未命名模式和变量(UnnamedPatternsandVariables)。该新特性的目的是提高代码的可读性和可维护性。下面通过一个例子来理解这个功能,try-catch块相信大家都不陌生,都是这样写的:try{......