-1

I'm following this tutorial for create a venv in python (for a flask's project on windows): https://docs.python.org/3/tutorial/venv.html

When i execute the following command:

python3 -m venv tutorial-env

the following error is generated:

Error: 'list' object has no attribute 'read'

I don't understand what the cause is, can you help me?

F.Arrighi
  • 11
  • 3
  • Please provide any code example :) And specify in which folder you are relative to venv and command to launch your code – Hotkuk Jun 11 '21 at 13:04
  • I believe its because of the hypen in the name of the environment you want to create. Try replacing it with an underscore. `python3 -m venv tutorial_env` – Muhd Mairaj Jun 11 '21 at 20:01

3 Answers3

1

I believe, it because of '-' in your virtual environment name. Try below command and make sure your python3 paths matches into command. Checkout this helpful documentation link.

c:\>c:\Python35\python -m venv c:\path\to\myenv
Chinmay T
  • 745
  • 1
  • 9
  • 17
1

I uninstalled a package called "subprocess.run" with "pip uninstall [package-name]" and that's all. You can run your project

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 10 '23 at 19:58
0

These are the steps I follow to create a new project and use venv:
Create a folder with the project name
Open Visual Studio Code (or your IDE) and open this folder
Make sure the terminal is open, if not open it
Create a folder for the virtual environment (the folder will be called also venv but can have another name:
python -m venv venv (it can take a while until it finishes)
Activate the virtual environment: cd venv (to enter the virtual environment folder) ./scripts/activate (to activate the virtual environment) and
cd .. to go back to the project folder

  • Thanks a lot for the answer. I tried your method but it keeps returning the same error (Error: 'list' object has no attribute 'read') – F.Arrighi Jun 11 '21 at 13:47
  • @Daniel You dont need to `cd venv` and then change the directory back. You can simply do `./venv/scripts/activate` and it will activate the virtual environment from the same directory you were in. – Muhd Mairaj Jun 11 '21 at 20:04