#๐ how do i get my python like this
131 messages ยท Page 1 of 1 (latest)
@errant bay
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
the screenshot depicts someone using an editor like PyCharm or Visual Studio Code.
python programs are .py files, and those files are fundamentally just plain text--even more plain than a Word document. any magic like that drop-down menu comes from a text editor that knows you're writing Python code.
up to you. I'm a pycharm fanboy, but the abundence of features can be overwhelming for a beginner. you could also use a text editor like notepad++ or sublime.
https://www.jetbrains.com/pycharm/download/?section=windows
this is the first result for googling "pycharm download" btw
The top one require you to pay
No
download the community one
Community edition at the lower one
It is VSC
They come with most feature you would ever need
VSC is an acronym for visual studio code--what's your point?
Yeah I just said it's vs code
ummmmmmmmmm I use the remote development tools every day
Same
just click next.
So most :)
On the left panel, click the drop-down menu and you can see your file
In the project
No
Lower
Where you can see a folder
You don't have any file coded
You need to create one
How would you create a file in explorer?
How would you do it?
Similar, but you should create it in the folder of the project
Just create it by righting clicking there instead
Ye
Basically, it just similar to a normal interface
IDE is just a all in one tooling for development (except probably a browser for researching stuff
pri
And check the autocomplete you ask for
Just type pri
In the file
And you can see what PyCharm suggest you
Also after that, I recommend you read this
https://www.jetbrains.com/help/pycharm/getting-started.html
*Certain features might be unavailable in the free edition
You need to install that package.
Run that command in the Terminal tab inside Pycharm. Pycharm creates a virtual environment that it runs your code in.
Bottom
The install command, yes
It doesn't hurt too, but isn't necessary.
You can
Wait, not that
Because of the virtual environment like I mentioned. That terminal you have open doesn't have the virtual environment activated. You need to either activate it, or use Pycharm's terminal instead, which auto-activates it when you open it.
!env
!envs
The main purpose of Python virtual environments is to create an isolated environment for Python projects. This means that each project can have its own dependencies, such as third party packages installed using pip, regardless of what dependencies every other project has.
To see the current environment in use by Python, you can run:
>>> import sys
>>> sys.executable
'/usr/bin/python3'
To see the environment in use by pip, you can do pip debug (pip3 debug for Linux/macOS). The 3rd line of the output will contain the path in use e.g. sys.executable: /usr/bin/python3.
If Python's sys.executable doesn't match pip's, then they are currently using different environments! This may cause Python to raise a ModuleNotFoundError when you try to use a package you just installed with pip, as it was installed to a different environment.
Why use a virtual environment?
- Resolve dependency issues by allowing the use of different versions of a package for different projects. For example, you could use Package A v2.7 for Project X and Package A v1.3 for Project Y.
- Make your project self-contained and reproducible by capturing all package dependencies in a requirements file. Try running
pip freezeto see what you currently have installed! - Keep your global
site-packages/directory tidy by removing the need to install packages system-wide which you might only need for one project.
Further reading:
To do what?
Ya, but to do what?
You ran the pip command that installed requests inside of Pycharm's terminal?
Do it again and screenshot it
Use python -m pip install requests. I can't remember how py insteracts with virtual environments.
And you don't need the --upgrade pip when installing a package.
Get rid of the part in the ' 's.
python -m pip install requests
I have to go unfortunately. Look into virtual environments. You need to run the code in the same environment that you installed the libraries into.
@errant bay
can you copy this text
here
"C:\Users\kbist\PycharmProjects\First Try With python.venv\Scripts\python.exe" -m pip install -r requirements.txt
run this
"C:\Users\kbist\PycharmProjects\First Try With python.venv\Scripts\python.exe" -m pip install -r requirements.txt
sorry made a mistake
Trying typing the dash m with your keyboard not copy paste
Same with the dash r
Try typing the double quotes yourself too.
(File link, were you on iPhone?)
im on android and idk why its saying that tbh, itll work in a normal cmd window
Double quote beginning and end of the path
I dunno, I'm just seeing their error msg.
see the grey space to the right of With python >
click that grey space and enter cmd then press enter
replace the text with cmd then press enter
also you did not git clone the project
did you delete everything in the box first then enter in cmd?
literally cmd
yes, although it wont work cause you did not git clone
"C:\Users\kbist\PycharmProjects\First Try With python\.venv\Scripts\python.exe" -m pip install -r requirements.txt
the github page said how to rerember
yeah expected
yes
you need to install git
or you can manually download the files
yes
you can close that
youll need to open another cmd window like i explained before
nice
now run this
no because you are using a venv
you didnt paste in the command correctly
you see what you did wrong?
just run this command
youre not in the project directory
just the last cd DiscordUsernameChecker
cd stands for change directory
now you can run this command
you didnt copy it correctly
no, its missing a \ between python and `.venv'
its because of Discord text formatting
Just activate the venv
!code
Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.
To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)
Then, to activate the new virtual environment:
Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate
Packages can then be installed to the virtual environment using pip, as normal.
For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.
Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.
Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
why?
cd ..
.venv\Scripts\activate.bat
they are 2 separate commands
huzah its activated now
now cd DiscordUsernameChecker
pip install -r requirements.txt
pip install -r requirements.txt
nice, now what did the github say
python cloud_checker.py
thats not really python related youll have to check the github page for guidance on that
youll have to activate the venv again
.venv\Scripts\activate.bat
youre not in the correct folder
here you was
do you understand what cd does?
to activate the venv, the parent folder
you only need to pip install once per venv
this folder
im sorry its getting late right now i gotta go sleep
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.