python - Package Management - Pip / Conda / Virtualenv
问题描述
I have been looking for an answer and reading about the following question but I still do not understand a theoretical aspect of using pip and conda on the same computer. Maybe someone can help me. The process I follow when I start a project is:
- git init
- create virtual environment (I use "pyenv virtualenv")
- check the installed packages doing "pip list" and "conda list"
Here is where I do not understand what is happening, "pip list" basically tells me I only have installed: "pip" and "setuptools"
I like this.
But conda imports everything I have outside the virtual environment (which is more than 50 packages), this I do not like so much. Whenever I start a project and try to use, for example, "pandas" it directly uses it taking the conda package so I do not have to install it. While this is convenient to avoid wasting time I thought that virtual environments actually wanted to avoid this.
I am a rookie but I have read in several places that if you create a project it is best practice to then do "pip freeze > requirements.txt" which then creates the list of packages and their version in case you want to replicate it in the future. The problem is that since my system is using the packages in conda they are not pulled to the pip freeze list. This entails that in the future I will not know what pandas package I used.
Questions:
- Is the scenario clear?
- What is recommended in this case? Should I start using conda only? (I personally like starting from 0 every project and building from there)
P.S.: when I install a package with pip it normally installs everything that is required to make that package work (which tend to be many packages), but when I look at the requirements.txt of projects on GitHub these are very short lists (example). What is best practice here? should I only put in my requirements.txt the one I installed o put the whole list that gets installed together?
解决方案
推荐阅读
- python - 美汤4解析
- asp.net-mvc -
未在 HTMLButtonElement.onclick 中定义 - jquery - JQuery 分离与删除
- angular - ngFor 和 ngIf 不起作用
- git - Travis 加密变量未正确解码 乱码=[安全]
- docker - ModuleNotFoundError:没有名为“flask_restful”的模块
- validation - 如何在 Angular 6 中上传之前验证文件
- python - Wagtail:获取兄弟姐妹属性
- javascript - Google 表格中的脚本
- firebase - 通过 firebase-tools API 部署,无需先前登录