我对此完全陌生。所以我使用“ 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 没有错误提及的目录。我检查了我的环境变量,那里的一切也都很好。请帮助我解决此错误。
谢谢您的时间。
答案 0 :(得分:5)
我认为较新版本的 pipenv 导致了错误,我在遇到相同问题时使用此命令并且对我有用,只需使用
pip install pipenv==2018.10.13
答案 1 :(得分:1)
您需要提供piplock文件或require.txt才能安装软件包
答案 2 :(得分:1)
我在卸载 Anaconda 时遇到了同样的问题。我按照以下步骤解决了
运行 regedit.exe
前往
计算机\HKEY_CURRENT_USER\Software\Python\PythonCore
答案 3 :(得分:0)
您是否尝试过conda install命令?为此,请在安装anaconda的文件夹中继续显示anaconda提示符cd。看看this。
conda install -c conda-forge pipenv
确保在运行conda install命令之前激活环境。要激活您的环境,请运行conda activate envname
。希望对您有所帮助!
答案 4 :(得分:0)
我只是在与pipenv
遇到类似的问题,该问题也给了我相同的错误消息。
WinError 2与您的一个Python安装/卸载中的损坏文件有关。我在regedit中搜索了Anaconda3,以确定我以前安装或卸载的哪个版本的Python引起了问题。
对我来说,它是Python 3.6.5。我将其安装在错误消息中的路径所在的位置(在您的情况下为D:/program_files/
)。然后,我只是使用安装exe卸载了它,然后停止获取这些错误消息。