Replit은 Python 프로젝트용 가상 환경을 구축할 수 없습니다.
문제
Replit Was Unable to Build the Virtual Environment for Python Project or the Project Not Giving Results As We Expected.
This Issue Can also happened to Other Online IDEs Also Like Glitch.
세부
Most Online IDE Already Use Virtual Environment By default already. even if you create an virtual environment with
python -m venv venvit will not gonna run again in next run like next day and all packages install withpip install --needs to install again.The venv by
python -m venv venvfor replit is not efficient.
첫 번째 솔루션
Replit uses Poetry Virtual Environment By Default for Python Project. Those are given below.
Note These should run under the shell tab not the console tab.
핍으로 명령하기
시로 명령하기python main.pypoetry run python main.pypip install package_namepoetry add package_namepython -m venv venvpoetry initsource venv/bin/activatepoetry shellpython manage.py runserverpoetry run python manage.py runserver
Mostly just add
poetry runat first of running script like add this script to runner file of replit.Click 3 dots in Open Editor of replit and click Show Hidden File and Edit the File Named
.replitto given below.
language = "python3" run = "poetry run python manage.py runserver 0.0.0.0:800" # this is for django
두 번째 솔루션
Try Installing the alternative virtual environment named
pipenvfor the installing packages viarequirements.txtfile.For Local Environment we add this package like
pip install pipenvbut for replit online IDE we go into shell tab and then add package by poetry.
poetry add pipenv # then run below comman to install dependencies from requirements.txt file pipenv -r requirements.txt
For pipenv Most Commands are already similar you just need to replace the word
pipwithpipenv.
For Activating Pipenv Virtual Environment typepipenv shell
.replitshould have something like below run command.
language = "python3" run = "pipenv install && pipenv run manage.py runserver 0.0.0.0:8000" # just like given below but upper will work perfectly. # run = "pipenv run manage.py runserver 0.0.0.0:8000"
This Commands for mostly running outside virtual environment without activating it directly.
핍으로 명령하기
Pipenv로 명령하기python main.pypipenv run python main.pypip install package_namepipenv install package_namepython -m venv venvpipenv initsource venv/bin/activate && pip install -r requirements.txtpipenv shell && pipenv shell또는 그냥pipenv installpython manage.py runserverpipenv run python manage.py runserver
결론
I Will Suggest You Use Poetry Because It Have Some Features for replit.
더 빠른 설치 및 파일 실행 프로세스( pipenv 와 비교). 다음날 repl을 다시 열어도 패키지가 삭제되지 않습니다. CPU 부하가 pipenv에 비해 낮았습니다.종속성을 설치하기 위해 패키지를 실행했는데 github에서 패키지에 디버깅을 위한 50개 이상의 종속성이 있었습니다 home-assistant/core.CPU가 과열되었지만 CPU Usags(For Me)의 선을 넘지 않았습니다.
Replit은 온라인 IDE, 호스팅 클라우드, 협업 프로그래밍 환경 등입니다. 나는 한동안 사용자였으며 내가 좋아하는 것을 말하고 싶습니다.
한 가지 솔루션이 어떤 식으로든 도움이 되었다면 응답해 주십시오.
안녕👋.
Reference
이 문제에 관하여(Replit은 Python 프로젝트용 가상 환경을 구축할 수 없습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/shriekdj/replit-was-unable-to-build-the-virtual-environment-for-python-project-14kk텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)