简体   繁体   English

从tar.gz安装python包

[英]installing a python package from tar.gz

I need to use the cvxopt package for python 3. I run Ubuntu. 我需要将cvxopt软件包用于python3。我运行Ubuntu。

So I downloaded cvxopt-1.1.9.tar.gz and extracted the content (a single folder called cvxopt-1.1.9) into a folder /home/myname/TargetFolder/ manually, not via the command window. 因此,我下载了cvxopt-1.1.9.tar.gz并将其内容(一个名为cvxopt-1.1.9的文件夹)手动而不是通过命令窗口提取到文件夹/ home / myname / TargetFolder /中。

  1. When I run the sequence .configure, then make and then sudo make install, none of them works. 当我运行序列.configure时,先进行make然后进行sudo make install,它们都不起作用。

  2. There is a setup.py file in /home/myname/TargetFolder/cvxopt-1.1.9/. /home/myname/TargetFolder/cvxopt-1.1.9/中有一个setup.py文件。 When I go to that directory in the command window and type python setup.py install, then I get the following error message: 当我在命令窗口中转到该目录并键入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: 您指定的安装目录(通过--install-dir,--prefix或distutils默认设置)为:

/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. 如果安装目录是系统拥有的目录,则可能需要以管理员或“ root”帐户登录。 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. 如果您没有对此计算机的管理访问权限,则可能希望选择其他安装目录,最好是PYTHONPATH环境变量中列出的安装目录。

For information on other options, you may wish to consult the documentation at: 有关其他选项的信息,您可能希望在以下位置查阅文档:

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

That link doesn't exist anymore. 该链接不再存在。

  1. So I follow the advice on http://cvxopt.org/install/ . 因此,我遵循http://cvxopt.org/install/上的建议。 Apart from the "python setup.py install" command, which didn't work for me, I tried the second thing on their list. 除了对我不起作用的“ python setup.py install”命令外,我尝试了他们列表中的第二件事。 Namely "pip install cvxopt" This gave: 即“ pip install cvxopt”,这给出了:

Collecting cvxopt Downloading cvxopt-1.1.9.tar.gz (1.9MB) 100% |████████████████████████████████| 收集cvxopt下载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-: 1.9MB 271kB / s用于收集软件包的构建轮:cvxopt运行setup.py bdist_wheel用于cvxopt命令/ 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 运行bdist_wheel运行其他很多东西

and then 接着

/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 / usr / bin / ld:找不到-llapack / usr / bin / ld:找不到-lblas collect2:错误:ld返回1退出状态错误:命令'gcc'失败,退出状态为1


Failed building wheel for cvxopt Failed to build cvxopt cvxopt的构建轮失败构建cvxopt的失败

and then 接着

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 安装收集的软件包:cvxopt为cvxopt运行setup.py install从命令/ 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')))“安装- -record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile:运行install运行build运行build_py UPDATING build / lib.linux-x86_64-3.5 / cvxopt / _version。 py将build / lib.linux-x86_64-3.5 / cvxopt / _version.py设置为'1.1.9',并运行build_ext建立'base'扩展名

and then after some more lines it says: 然后再显示几行:

/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 / usr / bin / ld:找不到-llapack / usr / bin / ld:找不到-lblas collect2:错误:ld返回1退出状态错误:命令'gcc'失败,退出状态为1


Command "/home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize; 命令“ / home / myname / anaconda3 / bin / python3 -c”导入设置工具,标记化; 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. 文件 ='/ tmp / pip-build-r3o_hfm6 / cvxopt / setup.py'; exec(compile(getattr(tokenize,'open',open)( file ).read()。replace('\\ r \\ n', '\\ n'), 文件 ,'exec'))“安装--record /tmp/pip-1f4yz1xm-record/install-record.txt-单一版本-外部管理的--compile”失败,错误代码为1在/ tmp / pip-build-r3o_hfm6 / cvxopt中,您正在使用pip版本7.1.2,但是版本9.0.1可用。 You should consider upgrading via the 'pip install --upgrade pip' command. 您应该考虑通过“ pip install --upgrade pip”命令进行升级。

If I understood more about Linux and Python I could have focused on the important things and shortened the post a little. 如果我对Linux和Python有了更多的了解,我本可以专注于重要的事情,并略微缩短了这篇文章。 But since I know nothing, I post everything I did to maximize the possibility of helpful responses. 但是,由于我一无所知,因此我发布了我所做的一切,以最大程度地提供有用的回复。

Maybe I just don't understand how python works. 也许我只是不了解python是如何工作的。 When I include a package I do this with the 当我包括一个包裹时,我会用

import package

command. 命令。 But import cvxopt doesn't work. 但是import cvxopt不起作用。 So if I understood what it is exactly doing, then maybe I could use logic to give her or him that cvxopt package, where it is looking for it. 因此,如果我了解它到底在做什么,那么也许我可以使用逻辑将要查找的cvxopt软件包提供给他或他。

Since you are running Ubuntu, simply run sudo apt-get install python-cvxopt 由于您正在运行Ubuntu,因此只需运行sudo apt-get install python-cvxopt

I can install it this way on 16.04. 我可以在16.04上以这种方式安装它。 Not sure what version you are running. 不知道您正在运行哪个版本。

It does look like the compiler (gcc) is complaining because you are missing dependencies (blas). 看起来确实是编译器(gcc)在抱怨,因为您缺少依赖项(blas)。 Installing via the package manager should solve your issues. 通过程序包管理器安装应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM