嗨,我通常使用conda来管理我的环境,但是现在我在一个项目中需要比笔记本电脑更大的功率。因此,我尝试使用大学的工作站,该工作站具有新的Intel Xeon。但是我没有管理员权限,并且工作站也没有conda,因此我不得不使用virtualenv和pip3。
如何requirements.txt从conda 生成可与pip3and 一起使用的from venv?
conda list -e > requirements.txt
Run Code Online (Sandbox Code Playgroud)
不会生成兼容文件:
= is not a valid operator. Did you mean == ?
Run Code Online (Sandbox Code Playgroud)
该conda输出是:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
certifi=2016.2.28=py36_0
cycler=0.10.0=py36_0
freetype=2.5.5=2
icu=54.1=0
libpng=1.6.30=1
matplotlib=2.0.2=np113py36_0
mkl=2017.0.3=0
numpy=1.13.1=py36_0
openssl=1.0.2l=0
pip=9.0.1=py36_1
pyparsing=2.2.0=py36_0
pyqt=5.6.0=py36_2
python=3.6.2=0
python-dateutil=2.6.1=py36_0
pytz=2017.2=py36_0
qt=5.6.2=2
readline=6.2=2
scikit-learn=0.19.0=np113py36_0
scipy=0.19.1=np113py36_0
setuptools=36.4.0=py36_1
sip=4.18=py36_0
six=1.10.0=py36_0
sqlite=3.13.0=0
tk=8.5.18=0
wheel=0.29.0=py36_0
xz=5.2.3=0 …Run Code Online (Sandbox Code Playgroud) 我正在使用Anaconda虚拟环境设置python项目。我正在生成requirements.txt,以便其他人可以轻松地为项目设置自己的虚拟环境。
我想知道,当其他开发人员想要为该项目做出贡献,但是想要使用virtualenv而不是Anaconda时,他们可以这样做吗?
我尝试了以下方法:
我在Anaconda环境中设置了一个空项目,并安装了aiohttp模块。然后conda list --export > requirements.txt生成以下内容:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
aiohttp=2.3.9=py36_0
async-timeout=2.0.0=py36hc3e01a3_0
certifi=2018.1.18=py36_0
chardet=3.0.4=py36h420ce6e_1
multidict=3.3.2=py36h72bac45_0
pip=9.0.1=py36h226ae91_4
python=3.6.4=h6538335_1
setuptools=38.4.0=py36_0
vc=14=h0510ff6_3
vs2015_runtime=14.0.25123=3
wheel=0.30.0=py36h6c3ec14_1
wincertstore=0.2=py36h7fe50ca_0
yarl=0.14.2=py36h27d1bf2_0
Run Code Online (Sandbox Code Playgroud)我在virtualenv环境中设置了一个空项目,并在那里也安装了aiohttp模块。pip freeze > requirements.txt然后生成:
aiohttp==3.0.1
async-timeout==2.0.0
attrs==17.4.0
chardet==3.0.4
idna==2.6
idna-ssl==1.0.0
multidict==4.1.0
yarl==1.1.0
Run Code Online (Sandbox Code Playgroud)因此,显然两者的输出是不同的,我的理论是:一旦我在项目上使用conda生成了requirements.txt文件,其他开发人员便不能选择virtualenv了-至少如果他们不准备通过以下方式安装长清单要求(当然,不仅仅是aiohttp模块)。
乍看之下,将conda生成的requirements.txt导入virtualenv(pip install -r requirements-conda.txt)上的项目会引发以下错误:
Invalid requirement: 'aiohttp=2.3.9=py36_0'
= is not a valid operator. Did you mean == …Run Code Online (Sandbox Code Playgroud)