我已经使用pycharm在Windows上开发了一个项目,并且希望在ubuntu服务器上进行部署。
我正在尝试使用以下命令创建requirements.txt
:
conda list -e > requirements.txt
conda list > requirements.txt
requirements.txt
取决于以下选项:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/win-64/blas-1.0-mkl.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/icc_rt-2017.0.4-h97af966_0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2018.0.3-0.tar.bz2
或者这个
# packages in environment at C:\ProgramData\Anaconda2\envs\myenvs:
#
# Name Version Build Channel
anyjson 0.3.3 py36h1110a06_1
arrow 0.12.1 py36_1
asn1crypto 0.24.0 py36_0
babel 2.6.0 py36_0
或者这个
name: myenv
channels:
- defaults
dependencies:
- anyjson=0.3.3=py36h1110a06_1
- arrow=0.12.1=py36_1
- asn1crypto=0.24.0=py36_0
- babel=2.6.0=py36_0
- blas=1.0=mkl
无论我怎么做,在某些情况下,我都会在ubuntu机器上收到错误消息,因为该软件包是针对Windows的:( / win-64 / )
https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2
我已经阅读了很多文档,但是我似乎无法获得想要的东西。 Conda (Python) Virtual Environment is not Portable from Windows to Linux
有解决方案吗?
答案 0 :(得分:1)
我正在处理同样的问题,我在 Anaconda 文档中找到了这个:
<块引用>Conda 在安装时不检查架构或依赖项 一个规范文件。为确保软件包正常工作,请确保 该文件是从工作环境创建的,并将其用于 相同的架构、操作系统和平台,例如 linux-64 或 osx-64
答案 1 :(得分:0)
默认情况下,conda会随构建一起导出您的环境,但是构建可以是特定于平台的。
对我有用的解决方案是使用--no-build
标志:
$ conda env export --no-build > environment.yml
希望这会有所帮助。