从 tar.gz 安装 python 包

installing a python package from tar.gz

我需要为 python 3 使用 cvxopt 包。我 运行 Ubuntu.

所以我下载了 cvxopt-1.1.9.tar.gz 并将内容(一个名为 cvxopt-1.1.9 的文件夹)提取到一个文件夹中 /home/myname/TargetFolder/ 手动,而不是通过命令 window.

  1. 当我运行序列.configure,然后make然后sudo make install,其中none有效。

  2. /home/myname/TargetFolder/cvxopt-1.1.9/中有一个setup.py文件。当我在命令 window 中转到该目录并键入 python setup.py install 时,我收到以下错误消息:

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the installation directory:

[Errno 13] Permission denied: '/home/myname/anaconda3/lib/python3.5/site-packages/test-easy-install-6110.write-test'

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

/home/myname/anaconda3/lib/python3.5/site-packages/

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

For information on other options, you may wish to consult the documentation at:

https://pythonhosted.org/setuptools/easy_install.html

那个link不存在了。

  1. 所以我听从了 http://cvxopt.org/install/ 上的建议。除了对我不起作用的 "python setup.py install" 命令外,我还尝试了他们列表中的第二个命令。即"pip install cvxopt" 这给了:

Collecting cvxopt Downloading cvxopt-1.1.9.tar.gz (1.9MB) 100% |████████████████████████████████| 1.9MB 271kB/s Building wheels for collected packages: cvxopt Running setup.py bdist_wheel for cvxopt Complete output from command /home/myname/anaconda3/bin/python3 -c >"import setuptools;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';>exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpv0ura7txpip-wheel-:

running bdist_wheel running a lot of other stuff

然后是

/usr/bin/ld: cannot find -llapack /usr/bin/ld: cannot find -lblas collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1


Failed building wheel for cvxopt Failed to build cvxopt

然后是

Installing collected packages: cvxopt Running setup.py install for cvxopt Complete output from command /home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py UPDATING build/lib.linux-x86_64-3.5/cvxopt/_version.py set build/lib.linux-x86_64-3.5/cvxopt/_version.py to '1.1.9' running build_ext building 'base' extension

然后在几行之后它说:

/usr/bin/ld: cannot find -llapack /usr/bin/ld: cannot find -lblas collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1


Command "/home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-r3o_hfm6/cvxopt You are using pip version 7.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

如果我对 Linux 和 Python 了解得更多,我本可以专注于重要的事情并稍微缩短 post。但是因为我什么都不知道,所以我 post 我所做的一切都是为了最大限度地提高有用回复的可能性。

也许我只是不明白python是如何工作的。当我包含一个包时,我使用

import package

命令。但是 import cvxopt 不起作用。所以如果我明白它到底在做什么,那么也许我可以使用逻辑给她或他那个 cvxopt 包,它正在寻找它。

既然你是运行宁Ubuntu,只需运行sudo apt-get install python-cvxopt

我在16.04上可以这样安装。不确定你是什么版本 运行ning.

看起来编译器 (gcc) 确实在抱怨,因为您缺少依赖项 (blas)。通过包管理器安装应该可以解决您的问题。