【发布时间】:2020-07-31 09:56:08
【问题描述】:
我无法使用pip install <packagename> 安装软件包,因为我在安全墙后面。
我需要在 Ubuntu 16.04 服务器的 virtualenv 中安装 python 3.8,它原本有 python 3.5.2
为此,我在(手动)安装了所有依赖项之后在服务器上手动安装了virtualenv-20.0.28-py2.py3-none-any.whl。然后我通过virtualenv pytorch 创建了一个virtualenv(pytorch 是虚拟环境的名称)并通过source pytorch/bin/activate 激活它。
现在我处于 env 模式
(pytorch) user@ubuntu:~/my_packages$
当我执行 pip install Python-3.8.0.tgz 时,它会输出以下错误:
Processing ./Python-3.8.0.tgz
ERROR: Command errored out with exit status 1:
command: /home/user/my_packages/pytorch/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-9npp4vja/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-9npp4vja/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1d52yt0i
cwd: /tmp/pip-req-build-9npp4vja/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-9npp4vja/setup.py", line 2433, in <module>
main()
File "/tmp/pip-req-build-9npp4vja/setup.py", line 2392, in main
set_compiler_flags('LDFLAGS', 'PY_LDFLAGS_NODIST')
File "/tmp/pip-req-build-9npp4vja/setup.py", line 85, in set_compiler_flags
sysconfig.get_config_vars()[compiler_flags] = flags + ' ' + py_flags_nodist
TypeError: Can't convert 'NoneType' object to str implicitly
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
如何将 python 3.8 安装到 pytorch 环境中?
注意我只能手动安装包
【问题讨论】:
标签: python virtualenv setup.py