如何使用自定义构建Python创建virtualenv环境来解决此问题?
发布时间:2020-12-16 23:38:14 所属栏目:Python 来源:网络整理
导读:我需要在使用 Python 2.3.4的Linux机器上运行一些代码 预装.我不是那台机器的sudoers列表,所以我 将Python 2.6.4构建到我的主目录中的一个子目录中.然后我 试图使用virtualenv(第一次),但得到: $Python-2.6.4/python virtualenv/virtualenv.py ENVNew pytho
我需要在使用
Python 2.3.4的Linux机器上运行一些代码
预装.我不是那台机器的sudoers列表,所以我 将Python 2.6.4构建到我的主目录中的一个子目录中.然后我 试图使用virtualenv(第一次),但得到: $Python-2.6.4/python virtualenv/virtualenv.py ENV New python executable in ENV/bin/python Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Installing setuptools......... Complete output from command /apps/users/dspitzer/ENV/bin/python -c "#!python """Bootstrap setuptoo... " /apps/users/dspitzer/virtualen...6.egg: Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 'import site' failed; use -v for traceback Traceback (most recent call last): File "<string>",line 67,in <module> ImportError: No module named md5 ---------------------------------------- ...Installing setuptools...done. Traceback (most recent call last): File "virtualenv/virtualenv.py",line 1488,in <module> main() File "virtualenv/virtualenv.py",line 529,in main use_distribute=options.use_distribute) File "virtualenv/virtualenv.py",line 619,in create_environment install_setuptools(py_executable,unzip=unzip_setuptools) File "virtualenv/virtualenv.py",line 361,in install_setuptools _install_req(py_executable,unzip) File "virtualenv/virtualenv.py",line 337,in _install_req cwd=cwd) File "virtualenv/virtualenv.py",line 590,in call_subprocess % (cmd_desc,proc.returncode)) OSError: Command /apps/users/dspitzer/ENV/bin/python -c "#!python """Bootstrap setuptoo... " /apps/users/dspitzer/virtualen...6.egg failed with error code 1 我应该将PYTHONHOME设定为某个值吗? (我有意命名 不知道我是否可以忽略这些错误,我尝试安装鼻子 $cd nose-0.11.1/ $ls AUTHORS doc/ lgpl.txt nose.egg-info/ selftest.py* bin/ examples/ MANIFEST.in nosetests.1 setup.cfg build/ functional_tests/ NEWS PKG-INFO setup.py CHANGELOG install-rpm.sh* nose/ README.txt unit_tests/ $~/ENV/bin/python setup.py install Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Traceback (most recent call last): File "setup.py",line 1,in <module> from nose import __version__ as VERSION File "/apps/users/dspitzer/nose-0.11.1/nose/__init__.py",in <module> from nose.core import collector,main,run,run_exit,runmodule File "/apps/users/dspitzer/nose-0.11.1/nose/core.py",line 3,in <module> from __future__ import generators ImportError: No module named __future__ 有什么建议? 解决方法
你真的在你的自定义python构建上运行“make install”吗?通常你会想要做类似的事情
./configure --prefix=/path/to/installdir (other options) make make install 注意前缀可以是您具有完全写入权限的任何目录,例如我经常在共享托管环境中使用$HOME / apps. 然后运行/ path / to / installdir / bin / python,而不是构建目录中的那个.这应该创建正确的变量,然后你可以安装virtualenv.可能最好使用其setup.py安装virtualenv: cd virtualenv_source_dir /path/to/installdir/bin/python setup.py install 这可能需要首先使用相同的方法安装setuptools. 最后: # Just to be safe export PATH="/path/to/installdir/bin:$PATH" virtualenv ~/ENV ~/ENV/bin/pip install somepackage # (and such) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |