When I tried to create a virtual environment with Python, it didn't work

environment

The error I got this time

virtualenv my_python_env

I was able to create a virtual environment directory by typing,

.\my_python_env\Scripts\activate.bat

Even if you try to activate by hitting

.\my_python_env\Scripts\activate.bat : The term '.\my_python_env\Scripts\activate.bat' is not recognized as the name of a cmdlet, 
PS C:\Users\--\Documents\programming\Sakai\my_python_env\Scripts> cd..
PS C:\Users\--\Documents\programming\Sakai\my_python_env> .\Scripts\activate.bat
PS C:\Users\--\Documents\programming\Sakai\my_python_env> .\Scripts\activate.bat
PS C:\Users\--\Documents\programming\Sakai\my_python_env> .\Scripts\activate.bat
PS C:\Users\--\Documents\programming\Sakai\my_python_env> .\Scripts\activate.bat
PS C:\Users\--\Documents\programming\Sakai\my_python_env> cd..
PS C:\Users\--\Documents\programming\Sakai> cd .\my_python_env\   
PS C:\Users\--\Documents\programming\Sakai\my_python_env> .\Scripts\activate
.\Scripts\activate : File C:\Users\--\Documents\programming\Sakai\my_python_env\Scripts\activate.ps1 cannot be loaded       
because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

I get an error like that and it doesn't work. Even if I looked it up, I couldn't understand the reason and was in great trouble.

Solution

It really happened, but when I changed the default shell from powershell to command prompt, it was solved normally. I don't know why at all, but I'll share it for those who have the same problem and don't understand why. I will update it again when I understand the reason.

Recommended Posts

When I tried to create a virtual environment with Python, it didn't work
When I tried to create a project using Python on Docker with PyCharm, it didn't work, but it worked with Docker Compose.
Create a virtual environment with Python!
A story that didn't work when I tried to log in with the Python requests module
A memorandum when I tried to get it automatically with selenium
I tried to create a list of prime numbers with python
Create a virtual environment with conda in Python
Work in a virtual environment with Python virtualenv.
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
Steps to create a Python virtual environment with VS Code on Windows
[Outlook] I tried to automatically create a daily report email with Python
I tried to build a Mac Python development environment with pythonz + direnv
[Zaif] I tried to make it easy to trade virtual currencies with Python
I tried to create a table only with Django
I tried to draw a route map with Python
I want to work with a robot in python.
I tried to automatically generate a password with Python3
When I tried to make a VPC with AWS CDK but couldn't make it
I tried to easily create a fully automatic attendance system with Selenium + Python
Building a virtual environment with Python 3
I tried to automatically create a report with Markov chain
When I try to push with heroku, it doesn't work
I want to use a virtual environment with jupyter notebook!
Overview of Python virtual environment and how to create it
I tried to create a reinforcement learning environment for Othello with Open AI gym
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried scraping food recall information with Python to create a pandas data frame
I tried to create a linebot (implementation)
[5th] I tried to make a certain authenticator-like tool with python
I tried to create a server environment that runs on Windows 10
I tried to create a linebot (preparation)
[2nd] I tried to make a certain authenticator-like tool with python
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
Let's create a virtual environment for Python
[3rd] I tried to make a certain authenticator-like tool with python
Try to create a python environment with Visual Studio Code & WSL
I want to build a Python environment
Create a virtual environment with Python_Mac version
I made a server with Python socket and ssl and tried to access it from a browser
I tried to make a periodical process with Selenium and Python
I tried a functional language with Python
I tried to make a 2channel post notification application with Python
I tried to create Bulls and Cows with a shell program
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
Build a python virtual environment with pyenv
[1st] I tried to make a certain authenticator-like tool with python
I tried to improve the efficiency of daily work with Python
I wrote a script to create a Twitter Bot development environment quickly with AWS Lambda + Python 2.7
Add a Python virtual environment to VSCode
Python: I tried to make a flat / flat_map just right with a generator
I tried to communicate with a remote server by Socket communication with Python.
When I tried to run Python, it was skipped to the Microsoft Store
I was addicted to creating a Python venv environment with VS Code
I tried to create a plug-in with HULFT IoT Edge Streaming [Development] (2/3)
I tried to make a calculator with Tkinter so I will write it
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
I tried to discriminate a 6-digit number with a number discrimination application made with python
I tried to install Docker on Windows 10 Home but it didn't work