![]() ![]() Help = '''If set this flag, would print the precise version of the python.'''ĭescription = 'Detect the python version. '-p', '-precise', type = str2bool, nargs = '?', const = True, default = False, metavar = 'bool', Print( 'true' if check_use_conda( 'python3') or check_use_conda( 'python') else 'false') ![]() mode not in ( 'conda', 'python', 'python3', 'conda-meta', 'use-conda'): Finding conda packages CONTINUED ON BACK Managing multiple versions of Python Ways to specify a package version number for use with conda create or conda install commands, and in meta.yaml les. Could be: (1) conda: return conda path (2) python: return python3 path (3) conda-meta return conda-meta path of the conda (4) use-conda: return a bool, showing whether the current python is managed by conda.įormatter_class = argparse. '-m', '-mode', default = 'conda', metavar = 'str', ArgumentTypeError( 'Unsupported value encountered.') ![]() Python_path = find_primary_path( python_name). dirname( conda_path)), 'conda-meta')ĭef check_use_conda( python_name = 'python3'):Ĭonda_path = find_primary_path( 'conda'). ![]() join( python_dir, 'conda-meta')Ĭonda_meta_path = find_conda_meta_path_python( 'python3')Ĭonda_meta_path = find_conda_meta_path_python( 'python')Ĭonda_meta_path = os. dirname( python_dir)Ĭonda_meta_path = os. Python_path = find_primary_path( python_name) If necessary, you can also get the version number in the tuple format. decode( 'utf-8')ĭef find_conda_meta_path_python( python_name): To check the Python version using the platform module, use the following code: import platform print(platform.pythonversion ()) The output will be as follows: 3.8.3 Both code snippets output the Python version in the string format. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |