[尝试使用pipenv安装时出现ValueError

问题描述 投票:0回答:2

我对此完全陌生。所以我使用“ pip install pipenv”安装了pipenv。我有python版本3.8.2,pip版本20.1.1和pipenv版本2020.6.2。但是,当我尝试运行“ pipenv install”时,出现以下错误。

    C:\Users\rd463>pipenv install
Traceback (most recent call last):
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
    result_version = get_python_version(path)
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
    c = subprocess.Popen(version_cmd, **subprocess_kwargs)
  File "d:\python382\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "d:\python382\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\python382\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python382\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\python382\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "d:\python382\lib\site-packages\pipenv\cli\command.py", line 232, in install
    retcode = do_install(
  File "d:\python382\lib\site-packages\pipenv\core.py", line 1921, in do_install
    ensure_project(
  File "d:\python382\lib\site-packages\pipenv\core.py", line 576, in ensure_project
    ensure_virtualenv(
  File "d:\python382\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "d:\python382\lib\site-packages\pipenv\core.py", line 388, in ensure_python
    path_to_python = find_a_system_python(python)
  File "d:\python382\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
    return next(iter(finder.find_all_python_versions()), None)
  File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
    python_version_dict = getattr(self.system_path, "python_version_dict", {})
  File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
    self._system_path = self.create_system_path()
  File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
    return pyfinder_path.SystemPath.create(
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
    instance = instance._run_setup()
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
    new_instance = new_instance._setup_windows()
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
    windows_finder = WindowsFinder.create()
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
    return cls()
  File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
    versions[py_version.version_tuple[:5]] = base_dir
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
    result = super(PythonVersion, self).__getattribute__(key)
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
    self.patch,
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
    instance_dict = self.parse_executable(executable)
  File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
    raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'D:/program_files/Anaconda3/Scripts/python.exe'

运行'python -m pipenv.help'给出-

C:\Users\rd463>python -m pipenv.help

$ pipenv --support

Pipenv版本:'2020.6.2'

Pipenv位置:'D:\\python382\\lib\\site-packages\\pipenv'

Python位置:'D:\\python382\\python.exe'

找到Python安装:

再次出现相同的错误。

我在'D:/ python382'中安装了python没有错误提及的目录。我已经检查了我的环境变量,那里的一切也都很好。请帮助我解决此错误。

谢谢您的时间。

python valueerror pipenv
2个回答
0
投票

您是否尝试过conda install命令?

conda install -c conda-forge pipenv

运行conda install命令之前,请确保激活环境。要激活您的环境,请运行conda activate envname。希望对您有所帮助!


0
投票

您需要提供piplock文件或require.txt才能安装软件包

© www.soinside.com 2019 - 2024. All rights reserved.