首页 > 解决方案 > 创建 lib64 符号链接的 Tox 条件

问题描述

我有两个虚拟环境,都具有相同版本的 tox (3.13.2) 和相同的 python (2.7.5)。使用相同的 tox.ini 文件,我得到两种不同的行为:在一种情况下,有一个 lib64 符号链接,在另一种情况下没有。

是什么导致 tox 创建它?

Tox.ini 内容如下:

设置运行时环境

[tox]
envlist = env
minversion = 1.7.0
toxworkdir = {toxinidir}/virtenv
skipsdist = True

[testenv:rprs-env]
setenv=
    VIRTUAL_ENV = {envdir}
    PIP_USE_WHEEL= true
    PIP_NO_INDEX = true
deps = -r{toxinidir}/tox/requirements-pinned.txt
install_command = pip install --pre --find-links={toxinidir}/tox/wheelhouse {packages}

命令行显示:

test-devtree-Sxi7_C_t(feature/DTD-12|+4); ~/.virtualenvs/test_rprs_bootstrap/bin/tox -c tox.ini -r
env recreate: /home/usr/repos/test-devtree/Run/virtenv/env
env installdeps: -r/home/usr/repos/test-devtree/Run/tox/requirements-pinned.txt
env installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,backports.functools-lru-cache==1.5,blosc==1.2.4,click==6.7,click-help-colors==0.4,colored-traceback==0.3.0,coloredlogs==10.0,cycler==0.10.0,Cython==0.24.1,docopt==0.6.2,enum==0.4.6,enum34==1.1.6,funcsigs==1.0.2,future==0.16.0,h5py==2.5.0,h5pyViewer==0.0.1.3,hickle==1.3.0,humanfriendly==4.16.1,humanize==0.5.1,kiwisolver==1.0.1,matplotlib==2.2.3,mock==1.0.0,monotonic==1.5,MySQL-python==1.2.3,nose==1.3.7,numexpr==2.6.8,numpy==1.15.1,pandas==0.23.4,pbr==1.10.0,py==1.4.30,Pygments==2.0.2,pyparsing==2.1.10,python-cjson==1.0.5,python-dateutil==2.7.3,pytz==2016.7,scipy==1.1.0,six==1.11.0,SQLAlchemy==0.9.7,subprocess32==3.2.7,sympy==0.7.6,tables==3.4.4,tox==1.7.0,Twisted==11.0.0,ujson==1.33,virtualenv==1.11.4,xlwt==1.0.0,zope.interface==4.1.1
env run-test-pre: PYTHONHASHSEED='1275167437'
__________________________________________________________________________________________________________________________________________________________ summary __________________________________________________________________________________________________________________________________________________________
  env: commands succeeded
  congratulations :)
test-devtree-Sxi7_C_t(feature/DTD-12|+4); ls -l virtenv/env/
total 4.0K
4.0K drwxrwxr-x. 2 usr usr 4.0K Sep  2 12:25 bin/
   0 drwxrwxr-x. 2 usr usr   22 Sep  2 12:25 include/
   0 drwxrwxr-x. 3 usr usr   22 Sep  2 12:25 lib/
   0 lrwxrwxrwx. 1 usr usr    3 Sep  2 12:25 lib64 -> lib/
   0 drwxrwxr-x. 2 usr usr   81 Sep  2 12:25 log/
   0 drwxrwxr-x. 3 usr usr   17 Sep  2 12:25 man/
   0 drwxrwxr-x. 3 usr usr   16 Sep  2 12:25 share/
   0 drwxrwxr-x. 2 usr usr    6 Sep  2 12:25 tmp/
test-devtree-Sxi7_C_t(feature/DTD-12|+4); tox -c tox.ini -r 
env recreate: /home/usr/repos/test-devtree/Run/virtenv/env
env installdeps: -r/home/usr/repos/test-devtree/Run/tox/requirements-pinned.txt
env installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,backports.functools-lru-cache==1.5,blosc==1.2.4,click==6.7,click-help-colors==0.4,colored-traceback==0.3.0,coloredlogs==10.0,cycler==0.10.0,Cython==0.24.1,docopt==0.6.2,enum==0.4.6,enum34==1.1.6,funcsigs==1.0.2,future==0.16.0,h5py==2.5.0,h5pyViewer==0.0.1.3,hickle==1.3.0,humanfriendly==4.16.1,humanize==0.5.1,kiwisolver==1.0.1,matplotlib==2.2.3,mock==1.0.0,monotonic==1.5,MySQL-python==1.2.3,nose==1.3.7,numexpr==2.6.8,numpy==1.15.1,pandas==0.23.4,pbr==1.10.0,py==1.4.30,Pygments==2.0.2,pyparsing==2.1.10,python-cjson==1.0.5,python-dateutil==2.7.3,pytz==2016.7,scipy==1.1.0,six==1.11.0,SQLAlchemy==0.9.7,subprocess32==3.2.7,sympy==0.7.6,tables==3.4.4,tox==1.7.0,Twisted==11.0.0,ujson==1.33,virtualenv==1.11.4,xlwt==1.0.0,zope.interface==4.1.1
env run-test-pre: PYTHONHASHSEED='3823901851'
__________________________________________________________________________________________________________________________________________________________ summary __________________________________________________________________________________________________________________________________________________________
  env: commands succeeded
  congratulations :)
test-devtree-Sxi7_C_t(feature/DTD-12|+4); ls -l virtenv/env/
total 4.0K
4.0K drwxrwxr-x. 2 usr usr 4.0K Sep  2 12:26 bin/
   0 drwxrwxr-x. 2 usr usr   22 Sep  2 12:25 include/
   0 drwxrwxr-x. 3 usr usr   22 Sep  2 12:25 lib/
   0 drwxrwxr-x. 2 usr usr   81 Sep  2 12:26 log/
   0 drwxrwxr-x. 3 usr usr   17 Sep  2 12:25 man/
   0 drwxrwxr-x. 3 usr usr   16 Sep  2 12:26 share/
   0 drwxrwxr-x. 2 usr usr    6 Sep  2 12:26 tmp/
test-devtree-Sxi7_C_t(feature/DTD-12|+4); tox --version    
3.13.2 imported from /home/usr/.virtualenvs/test-devtree-Sxi7_C_t/lib/python2.7/site-packages/tox/__init__.pyc
test-devtree-Sxi7_C_t(feature/DTD-12|+4); ~/.virtualenvs/test_rprs_bootstrap/bin/tox --version    
3.13.2 imported from /home/usr/.virtualenvs/test_rprs_bootstrap/lib/python2.7/site-packages/tox/__init__.pyc

标签: pythonpython-2.7toxpyenv

解决方案


☠ pyenv 是罪魁祸首!

如果您使用本地安装的版本,然后安装 tox,然后使用该 tox,则不会lib64创建符号链接。但是,如果您指定pyenv local system为要使用的 Python 版本,则使用以下命令创建您的 pipenv 虚拟环境

pipenv install --ignore-pipfile --python=/usr/bin/python

你应该得到 tox 来创建一个lib64符号链接。

一个更好的解决方案(20/20 后见之明)是不要依赖lib64Python……</p>


推荐阅读