-2

I need python3.6 for tensorflow installation, so I downloaded python3.6.12.tar. And I found that I should pip install tarfile. However, in this case it is an older version of python. FYI, In my computer(laptop) I installed python3.9. My question is: can I pip install python.tar inside a virtualenv?

6
  • 1
    No, you cannot install Python with pip. Commented Dec 14, 2020 at 14:54
  • I'm trying to "setup.py install" right now but it gives me some kind of error... Commented Dec 14, 2020 at 15:10
  • Traceback (most recent call last): File "blahblahblah\Python36\setup.py", line 29, in <module> set_compiler_flags('CFLAGS', 'PY_CFLAGS_NODIST') File "blahblahblah\Python36\setup.py", line 27, in set_compiler_flags sysconfig.get_config_vars()[compiler_flags] = flags + ' ' + py_flags_nodist TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' Commented Dec 14, 2020 at 15:11
  • github.com/python/cpython#build-instructions Commented Dec 14, 2020 at 15:30
  • stackoverflow.com/… Commented Dec 14, 2020 at 15:33

1 Answer 1

1

This is not how virtual environments work. I suggest you to do a little bit more research on virtual environments in Python.

Virtual Environments and Packages

Basically you need to install the necessary python version onto your machine. Then go ahead and use that specific python (which is version 3.6 in your case), to create a virtual environment with the command

~ /usr/bin/<path-to-python3.6> -m venv venv

This command will create a folder called venv. Now you need to source the activation script inside this folder to activate your environment.


Handy note: if you are dealing with different versions of python, a more robust way of handling such situations is via using a tool called pyenv.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.