我正在 Windows 7 64 位机器上安装/设置 Julia。我在安装 GLPK 包时遇到问题。到目前为止,我试图完全重新安装 Julia,但没有成功。我尝试删除 .julia 文件夹和我的首选项,但没有成功。我总是收到以下错误:
julia> Pkg.build("GLPK")
INFO: Building GLPK
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downl
oads
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads already created
INFO: Downloading file http://downloads.sourceforge.net/project/winglpk/winglpk/
GLPK-4.52/winglpk-4.52.zip
INFO: Done downloading file http://downloads.sourceforge.net/project/winglpk/win
glpk/GLPK-4.52/winglpk-4.52.zip
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src\g
lpk-4.52\w32
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\winglpk-4.52
.zip
Error: Can not open file as archive
================================[ ERROR: GLPK ]=================================
failed process: Process(`7z x 'C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\w
inglpk-4.52.zip' -y '-oC:\Users\Justin\.julia\v0.3\GLPK\deps\src'`, ProcessExite
d(2)) [2]
while loading C:\Users\Justin\.julia\v0.3\GLPK\deps\build.jl, in expression star
ting on line 66
================================================================================
================================[ BUILD ERRORS ]================================
WARNING: GLPK had build errors.
- packages with build errors remain installed in C:\Users\Justin\.julia\v0.3
- build the package(s) and all dependencies with `Pkg.build("GLPK")`
- build a single package by running its `deps/build.jl` script
================================================================================
在我看来,问题出在“winglpk-4.52.zip”上,如果我尝试直接访问并解压缩该文件,我会收到一条错误消息,指出该文件无效且 Windows 无法打开。我尝试删除 GLPK 并从头开始,也没有运气。
有什么想法或建议吗?
更新:手动下载文件 'winglpk-4.52.zip' 并解压到位置 'C:\Users\Justin.julia\v0.3\GLPK\deps\src' 解决了这个问题。
但是,我收到另一个错误(不确定是否相关):
Cannot construct an affine expression with a term of type
(GenericAffExpr{Float64,Variable})*(Float64)
while loading In[6], in expression starting on line 16
in error at error.jl:21 (repeats 2 times)
此错误与命令有关:
@setObjective(myModel, Max, sum{x[i,j]*data[i,5], i=1:n,j=1:8});
我在我的 Mac 上安装了 Julia,这不会出错..